theReactSelect/Playground

Configuration

Options

Preview

Selected:

Generated Code

import { Select } from 'thereactselect';

const options = [
  { value: "apple", label: "Apple" },
  { value: "banana", label: "Banana" },
  { value: "orange", label: "Orange" },
  { value: "grape", label: "Grape" },
  { value: "strawberry", label: "Strawberry" },
  { value: "watermelon", label: "Watermelon" },
];

function MyComponent() {
  const [value, setValue] = useState<string | number | undefined>(undefined);

  return (
    <Select
      options={options}
      onValueChange={(value) => console.log(value)}
    />
  );
}