Row Actions Menu

An accessible dropdown menu for actions on an individual table row.

Define typed actions once, then pass each row to the menu. Actions can be hidden or disabled from the current row without coupling the component to TanStack Table.

Choose an action from any row.

ProjectOwnerStatus
Website redesignMaya ChenActive
Mobile applicationNoah WilliamsActive
Analytics dashboardAarav PatelArchived
Customer portalSofia GarciaActive

Installation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/r/row-actions-menu.json

Column definition

Create a typed RowAction<T>[], then use renderComponent in the actions column. The current row is passed into every callback and state function.

columns.ts

Direct usage

The component can also be rendered in any list or custom table. Use a row-specific label when the page contains multiple menus.

project-row.svelte

Accessibility

The dropdown manages focus, arrow-key navigation, Escape, and focus restoration. The trigger stops click propagation so it can safely sit inside a clickable row. shortcut is only a visual hint; register keyboard commands in your application.

Props

NameTypeDefaultDescription
rowTrequiredCurrent row value passed to action callbacks and state functions.
actionsRowAction<T>[]requiredActions rendered in the dropdown menu.
labelstring"Open row actions"Accessible label and tooltip for the ellipsis trigger.
menuLabelstringundefinedOptional heading displayed above the actions.
disabledbooleanfalseDisables the trigger. It is also disabled when no visible actions remain.
align"start" | "center" | "end""end"Alignment of the dropdown relative to its trigger.
sideOffsetnumber4Distance between the trigger and menu in pixels.
openbooleanfalseBindable open state for controlled usage.
classstringundefinedClasses applied to the trigger button.
contentClassstringundefinedClasses applied to the dropdown content.

RowAction<T>

NameTypeDefaultDescription
idstringrequiredStable key for the action.
labelstringrequiredVisible menu item text.
onSelect(row: T) => voidrequiredRuns with the current row when selected.
iconComponentundefinedOptional Svelte icon component.
shortcutstringundefinedVisual shortcut hint; keyboard behavior remains application-owned.
variant"default" | "destructive""default"Visual treatment for the menu item.
disabledboolean | ((row: T) => boolean)falseDisables the action globally or for the current row.
hiddenboolean | ((row: T) => boolean)falseHides the action globally or for the current row.
separatorBeforebooleanfalseAdds a separator before this action.