@spicy-ui/core
Version:
A themable and extensible React UI library, ready to use out of the box
33 lines (32 loc) • 1.16 kB
TypeScript
import * as React from 'react';
import { HTMLAttributes, LiteralUnion } from '../../types';
export interface SelectItem<V = any> {
value: V;
label: string;
}
export interface SelectI18n {
loading?: string;
noItems?: string;
}
export declare type SelectSizes = 'xs' | 'sm' | 'md' | 'lg';
export declare type SelectVariants = 'outlined' | 'filled' | 'underlined' | 'unstyled';
export interface SelectProps extends Omit<HTMLAttributes, 'onChange'> {
searchValue?: string;
onSearchChange?: (search: string) => void;
items: SelectItem[];
itemToString?: (item: SelectItem | null) => string;
renderItem?: (item: SelectItem | null, fallback?: string | null) => React.ReactNode;
value: SelectItem | null;
onChange: (value: SelectItem | null) => void;
isClearable?: boolean;
isDisabled?: boolean;
isInvalid?: boolean;
isLoading?: boolean;
isSearchable?: boolean;
autoFocus?: boolean;
placeholder?: string;
size?: LiteralUnion<SelectSizes>;
variant?: LiteralUnion<SelectVariants>;
i18n?: SelectI18n;
}
export declare const Select: React.FC<SelectProps>;