0.0.2 • Published 10 months ago

@spark-web/multi-select v0.0.2

Weekly downloads
-
License
-
Repository
github
Last release
10 months ago

title: Multi-Select storybookPath: forms-select--default

isExperimentalPackage: true

Allows the user to search and make multi selection from a list of values.

Example

Default

const [selectedOptions, setSelectedOptions] = React.useState();

return (
  <Stack gap="large">
    <MultiSelect
      options={[
        {
          label: '',
          options: [
            { value: 'SENT', label: 'Sent' },
            { value: 'COMPLETED', label: 'Completed' },
          ],
        },
      ]}
    />
  </Stack>
);

With Default Option

const [selectedOptions, setSelectedOptions] = React.useState();

return (
  <Stack gap="large">
    <MultiSelect
      options={[
        {
          label: 'Status',
          options: [
            { value: 'SENT', label: 'Sent' },
            { value: 'COMPLETED', label: 'Completed' },
          ],
        },
        {
          label: 'Payment',
          options: [
            { value: 'CASH', label: 'Cash' },
            { value: 'CARD', label: 'Card' },
          ],
        },
      ]}
      placeholder="Select type"
      onChange={selected => setSelectedOptions(selected)}
      defaultOptions={[
        { value: 'CASH', label: 'Cash' },
        { value: 'SENT', label: 'Sent' },
      ]}
    />
  </Stack>
);

Props