@mks2508/mks-ui
Components

Combobox

Searchable select component with filtering, custom rendering, and keyboard navigation.

Combobox

A searchable selection component combining a text input with a filterable dropdown list.

Import

import { Combobox } from '@mks2508/mks-ui/react';

Basic Usage

Basic Usage
.tsx
const frameworks = [
{ value: 'react', label: 'React' },
{ value: 'vue', label: 'Vue' },
{ value: 'svelte', label: 'Svelte' },
{ value: 'solid', label: 'Solid' },
];

<Combobox
options={frameworks}
placeholder="Select framework..."
emptyText="No frameworks found."
/>

Controlled

const [value, setValue] = useState('');

const frameworks = [
  { value: 'react', label: 'React' },
  { value: 'vue', label: 'Vue' },
  { value: 'svelte', label: 'Svelte' },
];

<Combobox
  options={frameworks}
  value={value}
  onValueChange={setValue}
  placeholder="Search..."
/>

API Reference

PropTypeDefaultDescription
optionsArray<{ value: string; label: string }>[]List of selectable options
valuestringControlled selected value
onValueChange(value: string) => voidSelection change handler
placeholderstringPlaceholder text
emptyTextstringText shown when no options match
classNamestringAdditional CSS classes