@vtex/admin-ui
Version:
> VTEX admin component library
18 lines (17 loc) • 633 B
TypeScript
import type { FilterItem, Key, GenericFilterStateReturn } from './base-filter.state';
export declare function useFilterState(props: UseFilterStateProps): UseFilterReturn;
export interface UseFilterReturn extends GenericFilterStateReturn {
appliedItem: FilterItem | null;
appliedKey: Key | null;
}
export interface UseFilterStateProps {
/** Function called when a change is applied. */
onChange?: ({ selected }: {
selected: Key | null;
}) => void;
/** The initial selected key. */
initialApplied?: Key;
/** Filter button label. */
label: string;
items: FilterItem[];
}