@papernote/ui
Version:
A modern React component library with a paper notebook aesthetic - minimal, professional, and expressive
77 lines • 2.07 kB
TypeScript
import React from 'react';
export interface ComboboxHandle {
focus: () => void;
blur: () => void;
open: () => void;
close: () => void;
}
export interface ComboboxOption {
/** Option value */
value: string;
/** Display label */
label: string;
/** Optional icon */
icon?: React.ComponentType<any>;
/** Disabled state */
disabled?: boolean;
}
export interface ComboboxProps {
/** Selected value */
value?: string;
/** Change handler */
onChange?: (value: string) => void;
/** Available options */
options: ComboboxOption[];
/** Search handler (for async/server-side filtering) */
onSearch?: (query: string) => void;
/** Create option handler */
onCreateOption?: (value: string) => void;
/** Input label */
label?: string;
/** Placeholder text */
placeholder?: string;
/** Allow custom value input (typeahead mode) */
allowCustomValue?: boolean;
/** Loading state */
loading?: boolean;
/** Validation state */
validationState?: 'error' | 'success' | 'warning' | null;
/** Validation message */
validationMessage?: string;
/** Helper text */
helperText?: string;
/** Required field */
required?: boolean;
/** Disabled state */
disabled?: boolean;
/** Custom className */
className?: string;
/** Size variant */
size?: 'sm' | 'md' | 'lg';
}
/**
* Combobox component - searchable select with typeahead and custom value support.
*
* Features:
* - Typeahead search with filtering
* - Create custom options
* - Async search support
* - Keyboard navigation
* - Validation states
* - Custom value input
*
* @example
* ```tsx
* <Combobox
* label="Country"
* value={country}
* onChange={setCountry}
* options={countryOptions}
* allowCustomValue
* onCreateOption={handleCreateCountry}
* />
* ```
*/
declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<ComboboxHandle>>;
export default Combobox;
//# sourceMappingURL=Combobox.d.ts.map