Back to Twenty

Select

packages/twenty-docs/twenty-ui/input/select.mdx

2.2.01.4 KB
Original Source
<Frame> </Frame>

Allows users to pick a value from a list of predefined options.

<Tabs> <Tab title="Usage">
jsx
import { IconTwentyStar } from 'twenty-ui/display';

import { Select } from '@/ui/input/components/Select';

export const MyComponent = () => {

  return (
    <Select
      className
      disabled={false}
      label="Select an option"
      options={[
        { value: 'option1', label: 'Option A', Icon: IconTwentyStar },
        { value: 'option2', label: 'Option B', Icon: IconTwentyStar },
      ]}
      value="option1"
    />
  );
};

</Tab> <Tab title="Props">
PropsTypeDescription
classNamestringOptional CSS class for additional styling
disabledbooleanWhen set to true, disables user interaction with the component
labelstringThe label to describe the purpose of the Select component
onChangefunctionThe function called when the selected values change
optionsarrayRepresents the options available for the Selected component. It's an array of objects where each object has a value (the unique identifier), label (the unique identifier), and an optional Icon
valuestringRepresents the currently selected value. It should match one of the value properties in the options array
</Tab> </Tabs>