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.
<QtmDropdown>
<QtmDropdownTrigger>
<QtmButton>Dropdown button</QtmButton>
</QtmDropdownTrigger>
<QtmDropdownOverlay>
<QtmMenuItemList>
<QtmMenuItem>
<QtmMenuItemLabel>Menu Item</QtmMenuItemLabel>
</QtmMenuItem>
<QtmMenuItem>
<QtmMenuItemLabel>Menu Item</QtmMenuItemLabel>
</QtmMenuItem>
<QtmMenuItem>
<QtmMenuItemLabel>Menu Item</QtmMenuItemLabel>
</QtmMenuItem>
</QtmMenuItemList>
</QtmDropdownOverlay>
</QtmDropdown>
Dropdown overlay
You are able to implement inside a QtmDropdownOverlay
a menu item list, a paragraph or whatever.
You can insert any type of content within the dropdown overlay.
<QtmDropdown visible>
<QtmDropdownTrigger>
<QtmButton>Dropdown button</QtmButton>
</QtmDropdownTrigger>
<QtmDropdownOverlay>
<QtmTypography component="body-2" classes="p-m"
>You can insert any type of content within the dropdown
overlay.</QtmTypography
>
</QtmDropdownOverlay>
</QtmDropdown>
Visible
You can use visible
attribute to display dropdown-overlay.
<QtmDropdown visible> ... </QtmDropdown>
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
.
The dropdown is bottom left aligned.
<QtmDropdown visible placement="bottom-left"> ... </QtmDropdown>
The dropdown is center left aligned.
<QtmDropdown visible placement="bottom-center"> ... </QtmDropdown>
The dropdown is bottom right aligned.
<QtmDropdown visible placement="bottom-right"> ... </QtmDropdown>
The dropdown is top left aligned.
<QtmDropdown visible placement="top-left"> ... </QtmDropdown>
The dropdown is top center aligned.
<QtmDropdown visible placement="top-center"> ... </QtmDropdown>
The dropdown is top right aligned.
<QtmDropdown visible placement="top-right"> ... </QtmDropdown>
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
QtmDropdown
Property | Type | Default | Description |
---|---|---|---|
classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing | |
disabled | boolean | false | If true, the component is disabled. |
placement | "bottom-center" | "bottom-left" | "bottom-right" | "top-center" | "top-left" | "top-right" | Placement of dropdown overlay | |
visible | boolean | false | If true, the dropdown overlay is opened |
Event | Type | Description |
---|---|---|
onClickOutside | CustomEvent<void> | Callback fired when the dropdown overlay is closed. |
onVisibleChange | CustomEvent<DropdownVisibleData> | Callback fired when the dropdown trigger is clicked. function(event: object) => void |
QtmDropdownTrigger
Property | Type | Default | Description |
---|---|---|---|
classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing | |
disabled | boolean | false | If true, the dropdown trigger is disabled does not emit a trigger event. |
Event | Type | Description |
---|---|---|
onTriggerEvent | CustomEvent<void> | Callback fired when the dropdown trigger is clicked. |
QtmDropdownOverlay
Property | Type | Default | Description |
---|---|---|---|
classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing |