Skip to main content

Dropdown

import { Dropdown, Menu } from '@tulsa/core';

<Dropdown label='Choose an option'>
<Menu.Item
leadingVisual={<BiUser color='inherit' fontSize={"1.1em"} />}
trailingVisual={"⌘ + P"}
as="div"
>
Your Profile
</Menu.Item>
<Menu.Item
leadingVisual={<BiAlarm color='inherit' fontSize={"1.1em"} />}
trailingVisual={"⌘ + S"}
as="div"
>
Account Settings
</Menu.Item>
<Menu.Divider isRowDivider />
<Menu.Item as="div" variant='dangerous' selected trailingVisual={<BiChevronRight color='inherit' fontSize={"1.2em"} />}>Refer a Friend</Menu.Item>
<Menu.Divider />
<Menu.Item as="div" variant='dangerous'>Sign Out</Menu.Item>
</Dropdown>

Props

NameTypeDescriptionDefault
justify'left' | 'right'Controls the side that the dropdown is justified"right"
align'top' | 'bottom'Controls the side that the dropdown is aligned"bottom"
customTriggerReact.ReactElementControls the anchor of the dropdown
triggerPropsIButtonProps<'button'>Props that are passed to the default anchor of the dropdown. Only applies if a no custom trigger is applied.
labelstringLabel of the anchor of the dropdown. Only applies if no custom trigger is applied.
menuPropsHTMLProps<"ul">Props that are applied to the `<Menu />` of the dropdown.
itemRootPropsHTMLProps<"li">Props that are applied to the root `<Menu.Item />` of every item.

Examples

<Dropdown label='Choose an option' justify='left' align='top'>
<Menu.Item
leadingVisual={<BiUser color='inherit' fontSize={"1.1em"} />}
trailingVisual={"⌘ + P"}
as="div"
>
Your Profile
</Menu.Item>
<Menu.Item
leadingVisual={<BiAlarm color='inherit' fontSize={"1.1em"} />}
trailingVisual={"⌘ + S"}
as="div"
>
Account Settings
</Menu.Item>
<Menu.Divider isRowDivider />
<Menu.Item as="div" variant='dangerous' selected trailingVisual={<BiChevronRight color='inherit' fontSize={"1.2em"} />}>Refer a Friend</Menu.Item>
<Menu.Divider />
<Menu.Item as="div" variant='dangerous'>Sign Out</Menu.Item>
</Dropdown>