Skip to content

ActionMenu

Action menus provide a way to present a set of actions in a compact dropdown format. They’re ideal for secondary actions that don’t require primary button placement.

Use action menus to group secondary actions behind a single trigger button.

<script>
import { ActionMenu } from 'svelte-polaris';
const actions = [
{
content: 'Duplicate',
onAction: () => console.log('Duplicate action')
},
{
content: 'Edit',
onAction: () => console.log('Edit action')
},
{
content: 'Delete',
destructive: true,
onAction: () => console.log('Delete action')
}
];
</script>
<ActionMenu {actions} />

Organize actions into logical groups with optional group titles.

<script>
import { ActionMenu } from 'svelte-polaris';
const groups = [
{
title: 'File actions',
actions: [
{
content: 'Import',
onAction: () => console.log('Import')
},
{
content: 'Export',
onAction: () => console.log('Export')
}
]
},
{
title: 'Edit actions',
actions: [
{
content: 'Duplicate',
onAction: () => console.log('Duplicate')
},
{
content: 'Edit',
onAction: () => console.log('Edit')
}
]
},
{
actions: [
{
content: 'Delete',
destructive: true,
onAction: () => console.log('Delete')
}
]
}
];
</script>
<ActionMenu {groups} />

Add icons to actions for better visual recognition.

<script>
import { ActionMenu } from 'svelte-polaris';
const actions = [
{
content: 'Duplicate',
icon: 'DuplicateIcon',
onAction: () => console.log('Duplicate')
},
{
content: 'Edit',
icon: 'EditIcon',
onAction: () => console.log('Edit')
},
{
content: 'Archive',
icon: 'ArchiveIcon',
onAction: () => console.log('Archive')
},
{
content: 'Delete',
icon: 'DeleteIcon',
destructive: true,
onAction: () => console.log('Delete')
}
];
</script>
<ActionMenu {actions} />

Disable actions that are not currently available.

<script>
import { ActionMenu } from 'svelte-polaris';
const actions = [
{
content: 'View',
onAction: () => console.log('View')
},
{
content: 'Edit',
disabled: true
},
{
content: 'Duplicate',
onAction: () => console.log('Duplicate')
},
{
content: 'Delete',
destructive: true,
onAction: () => console.log('Delete')
}
];
</script>
<ActionMenu {actions} />

Control how many actions are shown before rolling up into a menu.

<script>
import { ActionMenu } from 'svelte-polaris';
const actions = [
{
content: 'Edit',
onAction: () => console.log('Edit')
},
{
content: 'Duplicate',
onAction: () => console.log('Duplicate')
},
{
content: 'Archive',
onAction: () => console.log('Archive')
},
{
content: 'Move',
onAction: () => console.log('Move')
},
{
content: 'Delete',
destructive: true,
onAction: () => console.log('Delete')
}
];
</script>
<ActionMenu {actions} rollup={2} />

Use action menus in cards to provide contextual actions for content.

<script>
import { ActionMenu, Card, Text, InlineStack } from 'svelte-polaris';
const actions = [
{
content: 'Edit product',
onAction: () => console.log('Edit product')
},
{
content: 'Duplicate product',
onAction: () => console.log('Duplicate product')
},
{
content: 'Archive product',
destructive: true,
onAction: () => console.log('Archive product')
}
];
</script>
<Card>
<InlineStack align="space-between" blockAlign="center">
<div>
<Text variant="headingMd" as="h3">Product Title</Text>
<Text variant="bodyMd" tone="subdued">SKU: ABC-123</Text>
</div>
<ActionMenu {actions} />
</InlineStack>
</Card>
PropTypeDefaultDescription
actionsMenuActionDescriptor[][]Collection of actions for menu
groupsMenuGroupDescriptor[][]Collection of grouped actions
rollupnumberNumber of actions to show before rolling up
rollupActionsLabelstring'More actions'Label for rollup actions button
onActionRollup(hasActions: boolean) => voidCallback when actions are rolled up
PropTypeDefaultDescription
contentstringText content for the action
accessibilityLabelstringAccessibility label for screen readers
helpTextstringAdditional descriptive text
iconstringIcon to display with the action
disabledbooleanfalseWhether the action is disabled
destructivebooleanfalseWhether the action is destructive
externalbooleanfalseWhether URL is external
urlstringURL for navigation actions
onAction() => voidCallback when action is triggered
PropTypeDefaultDescription
titlestringGroup title
accessibilityLabelstringAccessibility label for the group
actionsMenuActionDescriptor[][]Actions in this group
iconstringIcon for the group
detailsstringAdditional details for the group
  • Use action menus for secondary actions that don’t require primary placement
  • Group related actions together with descriptive titles
  • Place destructive actions at the bottom and mark them as destructive
  • Use rollup to prevent overwhelming users with too many visible actions
  • Provide clear, action-oriented labels for each menu item
  • Use icons consistently to improve scannability
  • Consider the frequency of use when ordering actions
  • Disable actions that are not currently available rather than hiding them
  • Action menus automatically manage focus and keyboard navigation
  • Use accessibilityLabel for actions that need clearer descriptions
  • Destructive actions are automatically announced as such to screen readers
  • The menu trigger button has proper ARIA attributes
  • Keyboard users can navigate through actions using arrow keys
  • The menu closes when focus leaves the component
  • Use ActionList for standalone action lists
  • Use Button for primary actions
  • Use Popover for custom dropdown content
  • Use ButtonGroup for related actions in a horizontal layout