import {ActionList} from '@primer/react'
Leading visuals are optional and appear at the start of an item. They can be octicons, avatars, and other custom visuals that fit a small area.
Trailing visual and trailing text can display auxiliary information. They're placed at the right of the item, and can denote status, keyboard shortcuts, or be used to set expectations about what the action does.
Item dividers allow users to parse heavier amounts of information. They're placed between items and are useful in complex lists, particularly when descriptions or multi-line text is present.
When you want to add links to the List instead of actions, use ActionList.LinkItem
Name | Type | Default | Description |
---|---|---|---|
children Required | ActionList.Item[] | ActionList.LinkItem[] | ActionList.Group[] | ||
variant | 'inset' | 'full' | 'inset' |
|
selectionVariant | 'single' | 'multiple' | Whether multiple items or a single item can be selected. | |
showDivider | boolean | false | Display a divider above each item in this list when it does not follow a header or divider. |
role | AriaRole | ARIA role describing the function of the list. | |
sx | SystemStyleObject |
Name | Type | Default | Description |
---|---|---|---|
children Required | React.ReactNode | ActionList.LeadingVisual | ActionList.Description | ActionList.TrailingVisual | ||
variant | 'default' | 'danger' | 'default' |
|
onSelect | (event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void | Callback that is called when the item is selected using either the mouse or keyboard. | |
selected | boolean | false | Indicate whether the item is selected. Only applies to items that can be selected. |
active | boolean | false | Indicate whether the item is active. There should never be more than one active item. |
disabled | boolean | false | Items that are disabled can not be clicked, selected, or navigated to. |
inactiveText | string | Text describing why the item is inactive. This may be used when an item's usual functionality is unavailable due to a system error such as a database outage. If there is a leading visual, the alert icon will replace the leading visual. If there is a trailing visual, it will replace the trailing visual. If there is no visual passed, it will be shown in the trailing visual slot to preserve left alignment of item content. Text will appear in a tooltip triggered by the alert icon in ActionList items, but text will appear below the description or title on ActionMenu items. | |
role | AriaRole | ARIA role describing the function of the item. | |
sx | SystemStyleObject |
Name | Type | Default | Description |
---|---|---|---|
children Required | React.ReactNode | Use to give a heading to list | |
as | React.ElementType | h3 | The level of the heading |
sx | SystemStyleObject |
Name | Type | Default | Description |
---|---|---|---|
children Required | React.ReactNode | ActionList.LeadingVisual | ActionList.Description | ActionList.TrailingVisual | ||
active | boolean | false | Indicate whether the item is active. There should never be more than one active item. |
ref | React.RefObject<HTMLAnchorElement> | ||
as | React.ElementType | "a" | The underlying element to render — either a HTML element name or a React component. |
sx | SystemStyleObject | ||
Additional props are passed to the <a> element. See a docs for a list of props accepted by the <a> element. |
Name | Type | Default | Description |
---|---|---|---|
children Required | React.ReactNode | Icon (or similar) positioned before item text. | |
sx | SystemStyleObject |
Name | Type | Default | Description |
---|---|---|---|
children Required | React.ReactNode | Visual positioned after item text. | |
sx | SystemStyleObject |
Name | Type | Default | Description |
---|---|---|---|
as | React.ElementType | button | HTML element to render as. |
label Required | string | Acccessible name for the control. | |
icon Required | string | Octicon to pass into IconButton. When this is not set, TrailingAction renders as a | |
href | string | href when the TrailingAction is rendered as a link. |
Name | Type | Default | Description |
---|---|---|---|
children Required | React.ReactNode | ||
variant | 'inline' | 'block' | 'inline' |
|
sx | SystemStyleObject |
Name | Type | Default | Description |
---|---|---|---|
children Required | React.ReactNode | Use to give a heading to the groups | |
variant | 'filled' | 'subtle' | 'subtle' |
|
as | React.ElementType | h3 | The level of the heading and it is only required (enforce by runtime warning) for lists. (i.e. not required for ActionMenu or listbox roles) |
sx | SystemStyleObject |
Name | Type | Default | Description |
---|---|---|---|
children Required | ActionList.Item[] | ActionList.LinkItem[] | ||
title Deprecated | string | Please use | |
auxiliaryText | string | Secondary text that provides additional information about the group. | |
variant | 'filled' | 'subtle' | 'subtle' |
|
selectionVariant | 'single' | 'multiple' | false | Set | |
role | AriaRole | ARIA role describing the function of the list inside the group. | |
sx | SystemStyleObject |