Dropdown
A dropdown menu component that displays a list of options triggered by a button or element
Installation
Import
Basic
With Links
With Links And Icons
Disabled
Large Size
Light Variant
With Prefix
With Shortcuts
With Labels And Dividers
Long List
Placement
Match Trigger Width
Trigger As Child
Nested
Nested In Popover
Selection
Nested Selection
With Search
Coordinate Mode
Click anywhere in this area to show dropdown at mouse position
Mentions With Coordinate Mode
With Trigger Ref
Using triggerRef
With Trigger Selector
Using #id selector
Using .class selector
Using [data-*] selector
Empty
Selection With Prefix Icons
With Prefix Icons (Check icon on the right)
Notice: When prefix icons exist, the Check icon appears on the right side.
Without Prefix Icons (Check icon on the left)
Notice: When no prefix icons exist, the Check icon appears on the left side (standard behavior).
Mixed: With and Without Icons
Notice: Items with prefix icons show Check on the right, items without show Check on the left.
Avoid Collisions
Comparison: avoidCollisions
When avoidCollisions=false, the dropdown will strictly follow the placement direction and may extend beyond the viewport. When avoidCollisions=true (default), it will automatically adjust to stay within the viewport.
avoidCollisions=true (default)
Dropdown will automatically adjust to avoid viewport collisions.
avoidCollisions=false
Dropdown strictly follows placement direction, may extend beyond viewport.
Edge Case: Near Viewport Edges
Positioned near the right edge to demonstrate the difference. Try opening both menus to see the behavior difference.
Different Placements with avoidCollisions=false
API reference
| DropdownProps | Type | Default |
|---|---|---|
autoSelectFirstItem | boolean |undefined | true |
avoidCollisions | boolean |undefined | true |
disabledNested | boolean |undefined | - |
focusManagerProps | Partial<FloatingFocusManagerProps> |undefined | - |
matchTriggerWidth | boolean |undefined | - |
offset | number |undefined | - |
onOpenChange | ((open: boolean) => void) |undefined | - |
open | boolean |undefined | - |
placement | undefined |"top" |"right" |"bottom" |"left" |"top-start" |"top-end" |"right-start" |"right-end" |"bottom-start" |"bottom-end" |"left-start" |"left-end" | - |
portalId | string |undefined | - |
position | { x: number; y: number; } |null |undefined | - |
readOnly | boolean |undefined | - |
root | HTMLElement |null |undefined | - |
selection | boolean |undefined | - |
triggerRef | RefObject<HTMLElement> |undefined | - |
triggerSelector | string |undefined | - |
variant | undefined |"default" |"light" |"reset" | - |