List
Components
UiList
Display a list of items. The items will be automatically filtered based on the command bar search panel value.
Example
Props
Name | Type | Description |
---|---|---|
items | UiListItem[] | The list items |
search | ?string | Items search filter |
selectedItem | ?string | Items search filter |
shouldFilter | ?boolean | Whether to filter the items |
noDataSlot | ?React.ReactNode | Element to show when no items match the filter |
disabledItemSelection | ?boolean | Disable the item selection |
onItemSelected | ?((value: string) => void) | Fired when an item is selected |
onSearchChanged | ?((value: string) => void) | Fired when the search is changed |
renderItem | ?((detail: UiListRenderItemDetail[], index: number) => React.ReactNode) | Custom list item renderer |
renderGroupHeader | ?((label: string, index: number) => React.ReactNode) | Custom group header renderer |
UiList.Item
Ui list item component.
Example
Props
Name | Type | Description |
---|---|---|
value | string | The list item’s unique value |
selected | ?boolean | Whether the item is selected |
title | ?string | React.ReactNode | The list item’s title that will be displayed |
actions | ?UiListItemAction[] | The list item’s actions |
subtitle | ?(string | React.ReactNode) | Subtitle that will be displayed next to the title |
icon | `?(string | React.ReactNode)` |
description | ?(string | React.ReactNode) | Shortcut description about the item |
alias | ?(string | React.ReactNode) | The list item’s alias |
keywords | ?string[] | Additional keywords for the item. It will be used when filtering the list items. |
onSelected | ?(() => void) | Will be fired when the item is selected |
suffix | ?(string | React.ReactNode) | The item’s suffix. Will be displayed on the item’s right side. |
UiList.Icon
Icon wrapper for the ui list item.
Example
Props
Name | Type | Description |
---|---|---|
icon | `string | React.Element` |
Types
UiListItem
The list item data.
Property | Type | Description |
---|---|---|
value | string | The list item’s unique value |
title | string | The list item’s title that will be displayed |
actions | ?UiListItemAction[] | The list item’s actions |
subtitle | ?string | Subtitle that will be displayed next to the title |
icon | ?React.ReactNode | The list item’s icon that will be displayed |
description | ?string | Shortcut description about the item |
metadata | ?any | The list item’s metadata |
alias | ?string | The list item’s alias |
keywords | ?string[] | Additional keywords for the item. It will be used when filtering the list items. |
searchOnly | ?boolean | Whether the item will only be shown when filtering the items |
onSelected | ?(() => void) | Will be fired when the item is selected |
suffix | ?(string | React.ReactNode) | The item’s suffix. Will be displayed on the item’s right side. |
UiListItemActionBase
Contains information about the list item.
Property | Type | Description |
---|---|---|
value | string | The action’s unique value |
title | string | The action’s title |
icon | ?React.ReactNode | The action’s icon |
disabled | ?boolean | Whether the item is disabled |
color | ?('default' | 'primary' | 'destructive') | The action’s color |
shortcut | ?KeyboardShortcut | The action’s keyboard shortcut |
UiListItemActionButton
List item action button type.
Property | Type | Description |
---|---|---|
type | button | Item action type |
onAction | () => void | Will be fired when the action is selected |
UiListItemActionBase |
UiListItemActionMenu
List item action button type.
Property | Type | Description |
---|---|---|
type | button | Item action type |
items | UiListItemActionButton[] | The action menu items |
UiListItemActionBase |
UiListItemAction
The list item action.
UiListRenderItemDetail
The item detail when passing a function in the renderItem
prop.
Property | Type | Description |
---|---|---|
item | UiListItem | The list item |
selected | boolean | Whether the item is selected |
ref | React.Ref<HTMLDivElement> | The item’s ref prop |
props | Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & { onSelected?: () => void } | The item’s props |
KeyboardShorcut
Keyboard shortcut.
Property | Type | Description |
---|---|---|
key | string | The keyboard shortcut key |
mod1 | KeyboardShortcutModifier | The keyboard shortcut modifier key |
mod2 | ?KeyboardShortcutModifier | The keyboard shortcut modifier key |
KeyboardShortcutModifier
Keyboard shortcut modifier.