For more examples, visit the Storybook.<StudsDropdownMenu>
<StudsDropdownMenuTrigger asChild>
<StudsButton variant="outline">
Open <MdKeyboardArrowDown />
</StudsButton>
</StudsDropdownMenuTrigger>
<StudsDropdownMenuContent>
<StudsDropdownMenuLabel>My Account</StudsDropdownMenuLabel>
<StudsDropdownMenuSeparator />
<StudsDropdownMenuGroup>
<StudsDropdownMenuItem>
Profile
<StudsDropdownMenuShortcut>⇧⌘P</StudsDropdownMenuShortcut>
</StudsDropdownMenuItem>
<StudsDropdownMenuItem>
Billing
<StudsDropdownMenuShortcut>⌘B</StudsDropdownMenuShortcut>
</StudsDropdownMenuItem>
<StudsDropdownMenuItem>
Settings
<StudsDropdownMenuShortcut>⌘S</StudsDropdownMenuShortcut>
</StudsDropdownMenuItem>
</StudsDropdownMenuGroup>
<StudsDropdownMenuSeparator />
<StudsDropdownMenuGroup>
<StudsDropdownMenuItem>Team</StudsDropdownMenuItem>
<StudsDropdownMenuSub>
<StudsDropdownMenuSubTrigger>
Invite users
</StudsDropdownMenuSubTrigger>
<StudsDropdownMenuPortal>
<StudsDropdownMenuSubContent>
<StudsDropdownMenuItem>Email</StudsDropdownMenuItem>
<StudsDropdownMenuItem>Message</StudsDropdownMenuItem>
<StudsDropdownMenuSeparator />
<StudsDropdownMenuItem>More...</StudsDropdownMenuItem>
</StudsDropdownMenuSubContent>
</StudsDropdownMenuPortal>
</StudsDropdownMenuSub>
<StudsDropdownMenuItem>
New Team
<StudsDropdownMenuShortcut>⌘+T</StudsDropdownMenuShortcut>
</StudsDropdownMenuItem>
</StudsDropdownMenuGroup>
<StudsDropdownMenuSeparator />
<StudsDropdownMenuItem disabled>API</StudsDropdownMenuItem>
<StudsDropdownMenuItem>
Log out
<StudsDropdownMenuShortcut>⇧⌘Q</StudsDropdownMenuShortcut>
</StudsDropdownMenuItem>
</StudsDropdownMenuContent>
</StudsDropdownMenu>
The open state of the dropdown menu when it is initially rendered.
The controlled open state of the dropdown menu.
Event handler called when the open state of the dropdown menu changes.
The modality of the dropdown menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.
The reading direction of submenus when applicable
If true, the component will render as a child of the parent component.
StudsDropdownPortal
Props
container
HTMLElement
default:"document.body"
The container element to which the dropdown menu will be appended.
If true, the dropdown menu will be mounted to the container regardless of its position in the DOM.
If true, the component will render as a child of the parent component.
If true, the dropdown menu will loop when navigating with arrow keys.
Event handler called when the dropdown menu is closed and focus is returned to the trigger.
Event handler called when the escape key is pressed while the dropdown menu is open.
Event handler called when a pointer is pressed outside the dropdown menu.
Event handler called when focus is moved outside the dropdown menu.
Event handler called when interaction occurs outside the dropdown menu.
If true, the dropdown menu will be mounted to the container
side
"top" | "right" | "bottom" | "left"
default:"bottom"
The side of the trigger where the dropdown menu will be positioned.
The distance in pixels from the trigger.
align
"start" | "center" | "end"
default:"start"
The preferred alignment against the trigger.
The distance in pixels from the trigger.
If true, the dropdown menu will avoid collisions with the viewport.
The boundary element to which the dropdown menu will be constrained.
collisionPadding
number | Padding
default:"0"
The padding in pixels to be applied to the collision boundary.
The padding in pixels to be applied to the arrow element.
sticky
"partial" | "always"
default:"partial"
If true, the dropdown menu will be sticky to the viewport.
If true, the dropdown menu will be hidden when it is detached from the trigger.
If true, the component will render as a child of the parent component.
Event handler called when the item is selected.
Optional text used for typeahead purposes
Whether to render the item with indentation to account for the presence of a checkbox or radio indicator.
When true, prevents the user from interacting with the item.
If true, the component will render as a child of the parent component.
The controlled checked state of the item.
Event handler called when the checked state changes.
When true, prevents the user from interacting with the item.
Event handler called when the item is selected.
Optional text used for typeahead purposes
If true, the component will render as a child of the parent component.
The value of the selected item in the group.
Event handler called when the value changes.
If true, the component will render as a child of the parent component.
The unique value of the item.
When true, prevents the user from interacting with the item.
Event handler called when the item is selected.
Optional text used for typeahead purposes
The open state of the submenu when it is initially rendered.
The controlled open state of the submenu.
Event handler called when the open state of the submenu changes.
If true, the component will render as a child of the parent component.
Whether to render the trigger with indentation.
When true, prevents the user from interacting with the trigger.
Optional text used for typeahead purposes
If true, the component will render as a child of the parent component.