Dropdown component
npm install @sushi-ui/su-dropdownDropdown component.
``
yarn install @sushi-ui/su-dropdown
or
npm install @sushi-ui/su-dropdown
`
`javascript`
import '@sushi-ui/su-dropdown/lib/su-dropdown.css'
import SuDropdown from '@sushi-ui/su-dropdown'
or
`html`
The .su-Dropdown and .su-Dropdown-content classes are mandatory in the markup..su-Dropdown-content
The element needs to be sibling to the trigger element..su-Dropdown-content
Only the trigger element and the element with class must be inside the .su-Dropdown wrapper element.su-Dropdown-content
Feel free to style the element.
Minimum HTML markup
`hmtl`
// dropdown content
Create a new dropdown instance
`javascript`
const el = document.querySelector('.su-Dropdown')
const dropdown = new SuDropdown(el, options)
| Prop | Type | Default | Valid options | Desc |
| --------------------- | -------------------- | ---------------- | ------------------------------------------------- | -------------------------------------------- |
| offsetX | _Number_ | 0 | Any number | - |offsetY
| | _Number_ | 0 | Any number | - |padding
| | _Number_ | 16 | Any number | Padding from boundary element |boundaries
| | _String,HTMLElement_ | viewport | scrollParent, window, viewport or any DOM element |placement
| | _String_ | bottom-start | auto, top, right, bottom, left | Option can also have modifier (-start, -end) |closeOnClickInside
| | _Boolean_ | false | true/false | - |closeOnClickOutside` | _Boolean_ | true | true/false | - |
|
#### toggle()
Show/hide dropdown
#### show()
Show dropdown
#### hide()
Hide dropdown
#### destroy()
Remove all event listeneres from the dropdown component.
Dispatches from the dropdown node element
#### show
Triggers on show
#### hide
Triggers on show
This project is licensed under the MIT License - see the LICENSE.md file for details