Enums: Dropdown

Place dropdown menus precisely with direction and positioning enums.

Dropdown enums help you control where menus open and how they stay anchored during scrolling or layout changes.

How it works

Use Direction to choose the menu opening direction, and DropdownPositionStrategy to control how the floating element is positioned.

Examples

  • Direction.Down for default dropdown behavior.
  • Direction.End for right-aligned menus in LTR layouts.
  • DropdownPositionStrategy.Fixed to reduce jumpiness while scrolling.

Reference

Direction

Direction of a dropdown menu.

  • Direction.Default Uses the default direction, usually the same as Down.
  • Direction.Down Trigger dropdown menus below an element (default behavior).
  • Direction.Up Trigger dropdown menus above an element.
  • Direction.End Trigger dropdown menus to the end of an element.
  • Direction.Start Trigger dropdown menus to the start of an element.

DropdownPositionStrategy

Defines the position strategy for the floating component.

  • DropdownPositionStrategy.Absolute The floating element is positioned relative to its nearest positioned ancestor. With most layouts, this usually requires the browser to do the least work when updating the position.
  • DropdownPositionStrategy.Fixed The floating element is positioned relative to its nearest containing block (usually the viewport). This is useful when the reference element is also fixed to reduce jumpiness with positioning while scrolling.
On this page