Dropdown
The dropdown component is a container for a dropdown-trigger and a dropdown-overlay.
- dropdown-trigger is the container for a button.
- dropdown-overlay the togglable container for a menu, hidden by default, with a white background and a shadow.
<Dropdown>
<DropdownTrigger>
<Button>Dropdown button</Button>
</DropdownTrigger>
<DropdownOverlay>
<MenuItemList>
<MenuItem id="dropdown-menu-1">
<MenuItemLabel>Menu Item</MenuItemLabel>
</MenuItem>
<MenuItem id="dropdown-menu-2">
<MenuItemLabel>Menu Item</MenuItemLabel>
</MenuItem>
<MenuItem id="dropdown-menu-3">
<MenuItemLabel>Menu Item</MenuItemLabel>
</MenuItem>
</MenuItemList>
</DropdownOverlay>
</Dropdown>
Dropdown overlay
You are able to implement inside a DropdownOverlay a menu item list, a paragraph or whatever.
<Dropdown visible>
<DropdownTrigger>
<Button>Dropdown button</Button>
</DropdownTrigger>
<DropdownOverlay>
<Typography component="body-2" classes="p-m"
>You can insert any type of content within the dropdown
overlay.</Typography
>
</DropdownOverlay>
</Dropdown>
Visible
You can use visible attribute to display dropdown-overlay.
<Dropdown visible> ... </Dropdown>
Placement
You can set top-center, top-right, top-left, bottom-center, bottom-right and bottom-left to placement property to place the dropdown overlay. By default the placement is bottom-left.
<Dropdown visible placement="bottom-left"> ... </Dropdown>
<Dropdown visible placement="bottom-center"> ... </Dropdown>
<Dropdown visible placement="bottom-right"> ... </Dropdown>
<Dropdown visible placement="top-left"> ... </Dropdown>
<Dropdown visible placement="top-center"> ... </Dropdown>
<Dropdown visible placement="top-right"> ... </Dropdown>
Customize style
Add your own classes in the classes attribute. This way you will be able to override or extend the styles applied to the component (you can use available utility classes by importing @qtm/css/dist/utilities.css).
API
Dropdown
The Dropdown component accepts all the props a standard <div> does in React (HTML, ARIA, data attributes, event handlers, and children). Its props are typed as React.HTMLAttributes<HTMLDivElement>. See more about supported HTML props in React's documentation.
DropdownOverlay
The DropdownOverlay component accepts all the props a standard <div> does in React (HTML, ARIA, data attributes, event handlers, and children). Its props are typed as React.HTMLAttributes<HTMLDivElement>. See more about supported HTML props in React's documentation.
DropdownTrigger
The DropdownTrigger component accepts all the props a standard <div> does in React (HTML, ARIA, data attributes, event handlers, and children). Its props are typed as React.HTMLAttributes<HTMLDivElement>. See more about supported HTML props in React's documentation.