Skip to content

KDropdown

Toggleable menu for displaying lists of links and actions.

Install

bash
pnpm add @ikun-ui/dropdown
bash
yarn add @ikun-ui/dropdown
bash
npm install @ikun-ui/dropdown

Basic usage

Trigger mode

Like KPopover, the trigger method is set through the trigger attribute

Use hideOnClick to define if dropdown closes on clicking.

Command event

Clicking each dropdown item fires an event whose parameter is assigned by each item.

External control

Control opening and closing through handleOpen and handleOpen

NameTypeDefaultDescription
placement'top' | 'left' | 'right' | 'bottom'bottomWhere the dropdown appears
trigger'manual' | 'click' | 'hover'hoverHow dropdown are triggered
disabledbooleanfalseWhether the dropdown is disabled.
hideOnClickbooleantrueWhether to hide dropdown after clicking dropdown-item.
maxHeightnumber-the max height of dropdown.
rolestringmenuThe ARIA role attribute for the dropdown. Depending on the use case.
tabindexnumber0tabindex of dropdown.
clsstring''Additional class for component
attrsRecord<string, string>{}Additional attributes
NameDescriptionType
changeTriggered when dropdown display status changes.(show: CustomEvent)=> void
commandTriggered when dropdown item is clicked.(command: CustomEvent)=> void
NameDescriptionType
handleOpenOpen the dropdown.()=> void
handleCloseClose the dropdown.()=> void
NameDescription
defaultCustomize default content
dropdownCustomize dropdown content
NameTypeDefaultDescription
commandstringbottomWhere the dropdown appears
disabledbooleanfalseWhether the dropdown is disabled.
dividerbooleanfalseWhether to hide dropdown after clicking dropdown-item.
clsstring''Additional class for component
attrsRecord<string, string>{}Additional attributes
NameDescription
defaultCustomize default content
dropdownCustomize dropdown content

MIT Licensed