Dropdown
<zn-dropdown> | ZnDropdown
Short summary of the component’s intended use.
<zn-dropdown></zn-dropdown>
Examples
First Example
TODO
Second Example
TODO
Importing
If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.
To import this component from the CDN using a script tag:
<script type="module" src="https://cdn.jsdelivr.net/npm/@kubex/zinc@1.0.0/dist/components/dropdown/dropdown.js"></script>
To import this component from the CDN using a JavaScript import:
import 'https://cdn.jsdelivr.net/npm/@kubex/zinc@1.0.0/dist/components/dropdown/dropdown.js';
To import this component using a bundler:
import '@kubex/zinc/dist/components/dropdown/dropdown.js';
Slots
Name | Description |
---|---|
(default) | The default slot. |
example
|
An example slot. |
Learn more about using slots.
Properties
Name | Description | Reflects | Type | Default |
---|---|---|---|---|
open
|
Indicates whether the dropdown is open |
|
boolean
|
false
|
placement
|
The placement of the dropdown. Note the actual placement may vary based on the available space |
|
'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' |
'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end'
|
'bottom-start'
|
disabled
|
Disable the dropdown |
|
boolean
|
false
|
stayOpenOnSelect
stay-open-on-select
|
By default, the dropdown will close when an item is selected. Set this to true to keep the dropdown open |
|
boolean
|
false
|
containingElement
|
The dropdown will close when the user interacts outside the element* |
HTMLElement | undefined
|
- | |
distance
|
The distance in pixels from which to offset the panel away from the trigger |
number
|
0
|
|
skidding
|
The distance in pixels from which to offset the panel away from the trigger |
number
|
0
|
|
hoist
|
Enable this option if the parent is overflow hidden and the dropdown is not visible |
boolean
|
true
|
|
sync
|
Syncs the popup width or height with the trigger element |
|
'width' | 'height' | 'both' | undefined
|
undefined
|
handlePanelSelect
|
Events | - | - | |
updateComplete |
A read-only promise that resolves when the component has finished updating. |
Learn more about attributes and properties.
Events
Name | React Event | Description | Event Detail |
---|---|---|---|
zn-event-name |
|
Emitted as an example. | - |
Learn more about events.
Methods
Name | Description | Arguments |
---|---|---|
show() |
Opens the dropdown | - |
hide() |
Closes the dropdown | - |
reposition() |
Instructs the dropdown to reposition itself | - |
Learn more about methods.
Custom Properties
Name | Description | Default |
---|---|---|
--example |
An example CSS custom property. |
Learn more about customizing CSS custom properties.
Parts
Name | Description |
---|---|
base |
The component’s base wrapper. |
Learn more about customizing CSS parts.
Dependencies
This component automatically imports the following dependencies.
<zn-example>