@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
33 lines • 1.17 kB
TypeScript
export interface UseFilterOptions extends Intl.CollatorOptions {
/**
* The locale to use for string comparison.
* Defaults to the user's runtime locale.
*/
locale?: Intl.LocalesArgument;
}
export interface Filter {
contains: <Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean;
startsWith: <Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean;
endsWith: <Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean;
}
declare function getFilter(options?: UseFilterOptions): Filter;
/**
* Matches items against a query using `Intl.Collator` for robust string matching.
*/
export declare const useCoreFilter: typeof getFilter;
export interface UseComboboxFilterOptions extends UseFilterOptions {
/**
* Whether the combobox is in multiple selection mode.
* @default false
*/
multiple?: boolean;
/**
* The current value of the combobox.
*/
value?: any;
}
/**
* Matches items against a query using `Intl.Collator` for robust string matching.
*/
export declare function useComboboxFilter(options?: UseComboboxFilterOptions): Filter;
export {};