@selkit/core
v0.19.0
Published
Headless state machine for Selkit — framework-agnostic select logic.
Readme
@selkit/core
The framework-agnostic state machine behind Selkit —
a headless select toolkit. Zero DOM, zero framework dependencies: it takes state
in, emits state and events out. Use it directly to build your own renderer, or
use an adapter (@selkit/dom,
@selkit/vue,
@selkit/react).
Install
pnpm add @selkit/coreUsage
import { createSelkit } from '@selkit/core'
const select = createSelkit({
options: [
{ value: 'a', label: 'Apple' },
{ value: 'b', label: 'Banana' },
],
multiple: true,
})
select.subscribe((state) => {
// render from state.visibleOptions / state.selected / state.isOpen …
})
select.open()
select.setQuery('ap')
select.selectActive()The controller exposes state, search, highlight/keyboard, selection, tagging,
async loading, a11y attribute computation and aria-live announcements — see the
API reference.
Docs
📖 cluion.github.io/selkit · 繁體中文
