Skip to content

KSelect

Select component to select value from options.

Install

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

Basic usage

Prefix icon and suffix icon select

Set the prefix through the icon attribute

Disabled select

Disable the select through the disabled attribute

Clearable select

Clear the select value through the clearable attribute

Binding Object

k-select supports binding objects, but you need to set the labelKey attribute and key attribute

Custom Render

Through slots you can customize option rendering

Virtual Render

k-select is implemented based on virtual lists to support high-performance rendering

k-select provides basic remote search capabilities

Sizes

Add size attribute to change the size of Select. It supports sm, md and lg.

Select Props

NameTypeDefaultDescription
valuestring | number | Record<string, any>-Binding value
dataListstring[] | number[] | Array<Record<string, any>>[]Render list data
iconPrefixstring-The class name of the prefix icon, following the unocss standard
iconSuffixstring-The class name of the suffix icon, following the unocss standard
placeholderstring'Please select value'Select's placeholder
maxHeightnumber250Display scroll bars above this height
labelKeystring'label'Required when value is an object, specify the field of "label"
valueKeystring'value'When value is an object, specify the field of "value"
keystring'id'Required when value is an object. It is the unique identifier of the object. It will be used in the virtual list.
disabledbooleanfalseDisable the Select
clearablebooleanfalseDecide if it can be cleared
fitInputWidthbooleantrueDetermine whether the width of the option is limited to be consistent with the selection box
sizesm | md |lgmdsize of Select.
clsstring-Additional class
attrsRecord<string, string>{}Additional attributes

Select Events

NameDescriptionType
updateValueEvent fired on select(value: HTMLSelectElement.value)=> void

Select Slots

NameDescription
prefixCustomize select prefix content
suffixCustomize select suffix content
defaultCustomize option content

MIT Licensed