fun-dropdown
Dropdowns are menus that display over other content. They are usually opened by clicking a button, and the dropdown menu will appear under the button.
The dropdown component has no opinions about the actual menu, but a fun-dropdown-menu is recommended.
Note that the open
property is one-way. Developers will need to listen to the
funDismiss
event and set open
to false themselves. The funDismiss
event is emitted when:
- user clicks outside the dropdown
- user presses the ‘escape’ key
If your popover will contain other floating content such as dropdowns or tooltips you should add class relative
to your body content,
so that positioning works properly in Firefox and safari.
Examples
Specifications
Properties
Property | Attribute | Required | Description | Type | Default |
---|---|---|---|---|---|
align | align | false | Which edge of the trigger element to align the dropdown content to. | "end" | "start" | 'start' |
backdrop | backdrop | false | Use a backdrop to capture clicks outside the popover rather than capturing clicks in the document. | boolean | |
debug | debug | false | Set to true for extra console debug logging. | boolean | |
offsetY | offset-y | false | Add vertical spacing between the dropdown and the trigger element. | number | 15 |
open | open | true | Is the dropdown open. | boolean | |
positionStrategy | position-strategy | false | Use to override the positioning strategy, which can be helpful in some conditions. | "absolute" | "fixed" | 'absolute' |
Events
Name | Description |
---|---|
funDismiss | Occurs when the popover is dismissed. |
Slots
Name | Description |
---|---|
content | The element to show when the dropdown is open. |
trigger | The element the trigger should be positioned under. Usually clicking this element should open the dropdown. |
Parts
Name | Description |
---|---|
dropdown |
Dependencies
Depends on
This documentation page generated from the source at fun-dropdown.tsx