Skip to content

SelectInput

Used to pick a value from predefined options.

Please select your pet
import {
createListCollection,
SelectInput,
type ListCollectionItem,
} from '@fintech-sandpit/ui/react';
const collection = createListCollection<ListCollectionItem>({
items: [
{ label: 'Dog', value: 'dog', group: 'Mammals' },
{ label: 'Cat', value: 'cat', group: 'Mammals' },
{ label: 'Canary', value: 'canary', group: 'Birds' },
{ label: 'Parrot', value: 'parrot', group: 'Birds' },
{ label: 'Goldfish', value: 'goldfish', group: 'Aquatic' },
{ label: 'Turtle', value: 'turtle', group: 'Aquatic', disabled: true },
],
groupBy: item => item.group ?? '',
});
return (
<SelectInput
collection={collection}
label="Pet"
placeholder="Select a pet"
hint="Please select your pet"
error="Invalid pet"
/>
);
NameTypeDefaultDescription
valuestring[]Controlled value of the select input
defaultValuestring[]Default (uncontrolled) value of the select input
namestringName of the input element
collectionCollectionOptions of the select input
orientationOrientationverticalOrientation of the select input
sizeSizemdSize of the select input
asNativebooleanfalseWhether the input is a native HTML select input
multiplebooleanfalseWhether the select input is multiple
labelstringLabel of the select input
hintstringHelper text of the select input
errorstringError text of the select input
requiredbooleanfalseWhether the select input is required
invalidbooleanfalseWhether the select input is invalid
readOnlybooleanfalseWhether the select input is read only
disabledbooleanfalseWhether the select input is disabled
placeholderstringPlaceholder of the select input
NameTypeDescription
onChange(value: string[]) => voidCallback fired when the value changes
type Collection = ListCollection<ListCollectionItem>
type ListCollectionItem = {
label: string;
value: string;
disabled?: boolean;
group?: string;
}
type Orientation = 'horizontal' | 'vertical'
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'