lune-ui-lib
Version:
Lune UI Components Library
32 lines (31 loc) • 1.08 kB
TypeScript
import type { SxProps } from '@mui/material';
export interface Props<T> {
value: T;
items: {
value: T;
label: string;
}[];
onChange: (value: T) => void;
sx?: SxProps;
menuSx?: SxProps;
menuElevation?: number;
disabled?: boolean;
label?: string;
error?: string | boolean;
}
/**
* Controlled select component
* Supports using objects as values (not just strings/numbers),
* which is useful for complex forms
* @param prop
* @param value - the currently selected value - its inferred type is used to infer the type of the items' value
* @param items - array of objects with value and label properties
* @param onChange - callback to be called with the selected item's value
* @param disabled - disables select
* @param label - used as a placeholder
* @param error - used to show error state
* @param sx
* @constructor
*/
declare const Select: <T>({ value, items, onChange, sx, menuSx, menuElevation, disabled, label, error, ...rest }: Props<T>) => import("react/jsx-runtime").JSX.Element;
export default Select;