import * as React from "react"; import { storiesOf } from "@storybook/react"; import { SearchableSelect, IKeyValuePair } from "../src/SearchableSelect"; import { Button } from "@material-ui/core"; function generateOptions() { const options = []; for (let i = 1; i <= 100; i++) { options.push({ key: i, value: `Entry ${i}` }); } return options as IKeyValuePair[]; } const SearchableSelectWrapper = () => { const [value, setValue] = React.useState(); const handleChange = ( event: React.ChangeEvent<{ name?: string; value: unknown }> ) => { setValue(event.target.value); }; return ( option.name} valuePropFn={(option: any) => option.property} /> ); }; const SearchableSelectWrapper2 = () => { const [value, setValue] = React.useState(21); const handleChange = ( event: React.ChangeEvent<{ name?: string; value: number }> ) => { setValue(event.target.value); }; return ( ); }; const SearchableSelectWrapper3 = () => { const [value, setValue] = React.useState([]); const handleChange = ( event: React.ChangeEvent<{ name?: string; value: [] }> ) => { setValue(event.target.value); }; return ( ); }; const SearchableSelectWrapper4 = () => { const [value, setValue] = React.useState([]); const handleChange = ( event: React.ChangeEvent<{ name?: string; value: [] }> ) => { setValue(event.target.value); }; return ( ); }; storiesOf("Searchable Select", module).add("Examples", () => { return (
Custom Props:



Standard: (shows 20 options by default)

Initial Value is set to 21



With maxVisibleOptions set to 50:



With showAll set to true



It's not advised to render all options if it exceeds ~20-50 Items. MUI-MenuItems are very slow
); });