<ListView
items={itemsArray}
defaultSelected={[]}
selected={[]}
indeterminate={[]}
onSelectionChange={(value) => console.log(value)}
>
{(items) =>
items.map((item) => (
<ListView.Option key={item.label} item={item}>
{item.label}
</ListView.Option>
))
}
</ListView>
ListView Props
In addition to the props listed below, the ListView component can accept any valid HTML div props.onSelectionChange
(value: unknown[]) => void
required
Callback when the selection changes.
children
(items) => ReactNode (items prop only) ReactNode (without items prop)
If the items prop is used, ListView’s children will be a function that
passes the items.
defaultSelected
ItemType[] (items prop only) string[] (without items prop)
Items passed to this prop will render with an indeterminate checkbox
(controlled)
ListView can be used with or without an items prop to manage your list of
items
Items passed to this prop will render with an checked checkbox (controlled)
<ListView.Option
item={item}
label="Option 1"
disabled={false}
onChange={(e) => console.log("Changed")}
>
Option content
</ListView.Option>
ListView.Option Props
In addition to the props listed below, the ListView.Option component can accept any valid HTML div props.item
{ label: string, defaultSelected?: boolean, [keys]: values }
Required if no label prop is supplied.
Required if no item prop is supplied.