UNPKG

@iazadur/hierarchical-select

Version:

A modern React component for hierarchical/dependent dropdowns with Ant Design and Shadcn UI support

36 lines (35 loc) 994 B
export interface OptionType { value: string | number; label: string; } export interface FieldConfig { index: number; options: OptionType[]; multiple?: boolean; placeholder?: string; label?: string; fetchOptions?: (parentValue: any) => Promise<OptionType[]> | OptionType[]; disabled?: boolean; errorMessage?: string; customStyle?: React.CSSProperties; className?: string; selectStyle?: React.CSSProperties; selectClassName?: string; } export interface HierarchicalSelectProps { fields: FieldConfig[]; designSystem?: 'antd' | 'shadcn'; onChange?: (values: (string | number | (string | number)[] | undefined)[]) => void; onError?: (error: Error) => void; className?: string; disabled?: boolean; } export interface SelectFieldProps { field: FieldConfig; value: any; onChange: (value: any) => void; isLoading?: boolean; disabled?: boolean; designSystem: 'antd' | 'shadcn'; error?: string; }