{`npm install @nib-components/select\n`}
\n \n\n{`As a form input, `}{`@nib-components/form-control`}{` must wrap this component to provide an accessible label, help text, and validation styling.`}
\n
{`import Select from '@nib-components/select';\n`}
\n {`\n \n \n`}
\n {`Options can be grouped by passing in as `}
{`\n \n \n`}
\n {`As the `}
{`All props passed directly to `}
{`Prop`} | \n{`Type`} | \n{`Default`} | \n{`Description`} | \n
---|---|---|---|
{`object or array`} | \n\n | {`The list of `} | \n |
{`string`} | \n\n | {`The `} | \n |
{`node`} | \n\n | {`Children can be provided to the `} | \n
{`Options can be passed to the Select via the `}
{`const options = {\n small: 'Small',\n medium: 'Medium',\n large: 'Large'\n};\n`}
\n {`Using an array guarantees order.`}
\n{`const options = [\n {value: 'small', label: 'Small'},\n {value: 'medium', label: 'Medium'},\n {value: 'large', label: 'Large'}\n];\n`}
\n {`Passing options as children also guarantees order.`}
\n{`\n`}
\n {`And allows for grouping of options.`}
\n{`\n`}
\n {`Set a meaningful placeholder value. A question makes a good placeholder value as it prompts the user to interact with the select and consider the available options.`}
\n{`Ensure you have a relevant label for the select (see our `}{`Form Control`}{` component) as this provides further context around the purpose of the select.`}
\n{`When `}
{`Try and limit the amount of available select options to less than 7. This will help the user to not be overwhelmed by options.`}
\n{`Do not set a default option value as users may miss the input entirely leading to null or incorrect data.`}
\n{`For shorter lists, consider using a `}{`Radio Group`}{`. This will help to expose all available options up front to the user.`}
\n{`For longer lists, consider using a typahead solution like our experimental `}{`Autocomplete`}{` component. Form design can help to avoid long select lists by asking the right questions beforehand, and filtering the list of options accordiongly.`}
\n