Skip to content

ActionList

Action lists display a list of actions or selectable options. They’re commonly used in menus, dropdowns, and navigation components. Refer Shopify’s docs for more information on how to use this component.

Use action lists to present a set of actions in a vertical list format.

Add icons to action list items to provide visual context.

Group related actions using sections with optional titles.

Disable actions that are not currently available.

<script>
import { ActionList } from 'svelte-polaris';
const actions = [
{ content: 'Copy', onAction: () => console.log('Copy') },
{ content: 'Paste', disabled: true },
{ content: 'Cut', onAction: () => console.log('Cut') },
{ content: 'Select all', onAction: () => console.log('Select all') }
];
</script>
<ActionList items={actions} />

Provide additional context with help text for actions.

<script>
import { ActionList } from 'svelte-polaris';
const actions = [
{
content: 'Publish product',
helpText: 'Make this product available in your online store',
onAction: () => console.log('Publish')
},
{
content: 'Unpublish product',
helpText: 'Hide this product from your online store',
onAction: () => console.log('Unpublish')
},
{
content: 'Archive product',
helpText: 'Remove this product from all sales channels',
destructive: true,
onAction: () => console.log('Archive')
}
];
</script>
<ActionList items={actions} />
PropTypeDefaultDescription
actionsActionListItemDescriptor[][]Collection of actions for list
sectionsActionListSection[][]Collection of sectioned action items
actionRolestring'menuitem'Role of each action
allowFilteringbooleanfalseRenders actions as filterable list
PropTypeDefaultDescription
contentstringText content for the action
accessibilityLabelstringAccessibility label for screen readers
helpTextstringAdditional descriptive text
iconstringIcon to display with the action
imagestringImage to display with the action
disabledbooleanfalseWhether the action is disabled
destructivebooleanfalseWhether the action is destructive
ellipsisbooleanfalseWhether to truncate long content
activebooleanfalseWhether the action is active/selected
rolestringARIA role for the action
urlstringURL for navigation actions
externalbooleanfalseWhether URL is external
onAction() => voidCallback when action is triggered
onMouseEnter() => voidCallback when mouse enters action
onTouchStart() => voidCallback when touch starts on action
PropTypeDefaultDescription
titlestringSection title
itemsActionListItemDescriptor[][]Actions in this section
  • Use action lists to present a set of actions in a consistent, scannable format
  • Group related actions using sections with descriptive titles
  • Use icons to provide visual context and improve scannability
  • Place destructive actions at the bottom and mark them as destructive
  • Provide help text for actions that need additional context
  • Disable actions that are not currently available rather than hiding them
  • Use consistent language and terminology across actions
  • Consider the order of actions based on frequency of use
  • Action lists automatically manage focus and keyboard navigation
  • Use accessibilityLabel for actions that need clearer descriptions
  • Destructive actions are automatically announced as such to screen readers
  • Disabled actions are properly announced and not focusable
  • Section titles are properly associated with their actions
  • Use ActionMenu for actions triggered by a button
  • Use Button for primary actions
  • Use ButtonGroup for related actions in a horizontal layout