Documentation menu
Getting Started
Components
Primitives
- Agent Thinking
- Alert
- Alert Dialog
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Checkbox
- Command
- Command Palette
- Context Menu
- Data Table
- Dialog
- Dropdown Menu
- Empty
- Field
- Glow Cloud
- Input
- Label
- Medication Schedule
- Period Tabs
- Popover
- Rainbow Button
- Scroll Area
- Select
- Selectable Card
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tag
- Textarea
- Timeline
- Tooltip
- Use Count Up
Charts and metrics
Patterns
- Confirm Button
- Date Picker
- Embedded
- Empty State
- Entity Drawer
- Error Boundary
- Field Row
- File Dropzone
- Form Dialog
- Kv
- List Editor
- List Page
- Live Time
- Mini Table
- Money
- Note Field
- Note Text
- Page Card
- Page Header
- Page Tabs
- Page Toolbar
- Person Cell
- Picture Field
- Print Card
- Range Switcher
- Row Actions
- Search Input
- Search Select
- Selected Box
- Signature Pad
- Status Badge
- Sub Nav Layout
- Suggest Input
- Tab Icons
- Table Footer
- Theme Accent Picker
- Time Picker
- View All Link
Dashboard cards
Advanced
Device frames
Website widgets
Website screens
Website panels
Patterns
Row Actions
The ⋯ menu at the end of a table row.
import { Pencil, Printer, Trash2 } from "lucide-react"
import { RowActions } from "@/registry/vcare/ui/row-actions"
export default function RowActionsDemo() {
return (
<RowActions
actions={[
{ label: "Edit", icon: <Pencil />, onSelect: () => undefined },
{ label: "Print", icon: <Printer />, onSelect: () => undefined },
"separator",
{ label: "Delete", icon: <Trash2 />, onSelect: () => undefined, destructive: true },
]}
/>
)
}Installation
npx shadcn@latest add @vcare/row-actionsOr install directly from the URL: https://ui.vcarehms.com/r/row-actions.json
- Install the dependencies:
npm i lucide-react - Add the registry items it uses: button, dropdown-menu, i18n.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/row-actions.tsx
import * as React from 'react';
import { MoreHorizontal } from 'lucide-react';
import { useTranslation } from '@/registry/vcare/lib/i18n';
import { Button } from '@/registry/vcare/ui/button';
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/registry/vcare/ui/dropdown-menu';
export type RowAction =
| 'separator'
| {
label: string;
icon?: React.ReactNode;
onSelect: () => void;
destructive?: boolean;
disabled?: boolean;
};
/** The "⋯" menu at the end of a table row. Clicks never reach the row, so it can sit inside clickable rows. */
export function RowActions({ actions, label, className }: { actions: RowAction[]; label?: string; className?: string }) {
const { t } = useTranslation();
const items = actions.filter((a, i) => a !== 'separator' || (i > 0 && i < actions.length - 1 && actions[i - 1] !== 'separator'));
if (items.length === 0) return null;
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="ghost"
size="icon-sm"
static
aria-label={label ?? t('actions')}
className={className}
onClick={(e) => e.stopPropagation()}
onKeyDown={(e) => e.stopPropagation()}
>
<MoreHorizontal />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" onClick={(e) => e.stopPropagation()}>
{items.map((a, i) =>
a === 'separator' ? (
<DropdownMenuSeparator key={`sep-${i}`} />
) : (
<DropdownMenuItem key={a.label} variant={a.destructive ? 'destructive' : 'default'} disabled={a.disabled} onSelect={a.onSelect}>
{a.icon}
{a.label}
</DropdownMenuItem>
),
)}
</DropdownMenuContent>
</DropdownMenu>
);
}Usage
import { RowActions } from "@/components/ui/row-actions"Exports
RowActions
Dependencies
lucide-react@^1.80.0(npm)@vcare/button(registry)@vcare/dropdown-menu(registry)@vcare/i18n(registry)
Raw item: /r/row-actions.json