Skip to main content

ActionButtonList

The ActionButtonList component renders a dropdown menu of action buttons, triggered by an icon. Ideal for context menus, inline action lists, and compact UI elements.

📦 Import

import { ActionButtonList } from "@sahilphondekar/react-component-library";

🧱 Props

NameTypeDefaultDescription
actionsArray<{ icon: node, label: string, onClick: function }>RequiredList of actions with icon, label, and click handler
menuIconnodeRequiredIcon element that triggers the menu
position"left" | "right" | "top" | "bottom""left"Position of the dropdown relative to the trigger button
menuIconClassNamestring""Custom classes for the menu icon button
menuClassNamestring""Custom classes for the dropdown container
containerClassNamestring""Custom classes for the dropdown outer container
actionClassNamestring""Custom classes for each individual action

📍 Positions

PositionDescription
leftMenu appears to the left of the trigger
rightMenu appears to the right of the trigger
topMenu appears above the trigger
bottomMenu appears below the trigger

🚀 Examples

Basic Usage

<ActionButtonList
menuIcon={<MoreVertical />}
actions={[
{
icon: <Edit size={16} />,
label: "Edit",
onClick: () => alert("Edit clicked"),
},
{
icon: <Trash2 size={16} />,
label: "Delete",
onClick: () => alert("Delete clicked"),
},
]}
/>

Right-Aligned Menu

<ActionButtonList
position="right"
menuIcon={<MoreVertical />}
actions={[
{
icon: <Eye />,
label: "View",
onClick: () => console.log("View"),
},
]}
/>

Custom Styling

<ActionButtonList
menuIcon={<MoreVertical />}
menuIconClassName="text-blue-600"
menuClassName="bg-gray-100 border border-gray-200"
actionClassName="text-sm text-gray-900"
/>

💡 Best Practices

  • Keep the number of actions limited for better usability.
  • Use descriptive labels and icons to clearly convey action intent.
  • Combine position and spacing utilities for precise dropdown placement.
  • Ensure dropdown content is keyboard accessible (coming soon in ARIA enhancements).