Overflow Actions

Overflow Actions: Connected pill rail for primary actions that springs open to reveal extra controls. Free MIT React & Next.js source with Motion and Tailwind CSS, live preview, CLI install and docs.

Install Overflow Actions

npx motion-ui-skill add overflow-actions

Components install as source into your project. The interactive page also includes preview, code, documentation and install tabs.

Dependencies

  • clsx
  • lucide-react
  • motion
  • react
  • tailwind-merge

Source files

Overflow Actions

Connected pill rail for primary actions that springs open to reveal extra controls.

Install

npx motion-ui-skill add overflow-actions

Dependencies

  • clsx
  • lucide-react
  • motion
  • react
  • tailwind-merge

Usage

"use client";

import { CalendarClock, Eye, GitBranch, Pin } from "lucide-react";
import { useState } from "react";
import {
  type OverflowActionItem,
  OverflowActions,
} from "@/components/motion/overflow-actions";

const primaryActions: OverflowActionItem[] = [
  {
    id: "preview",
    label: "Preview",
    icon: <Eye className="h-4 w-4" />,
  },
  {
    id: "pin",
    label: "Pin",
    icon: <Pin className="h-4 w-4" />,
  },
];

const overflowActions: OverflowActionItem[] = [
  {
    id: "branch",
    label: "Branch",
    icon: <GitBranch className="h-4 w-4" />,
  },
  {
    id: "schedule",
    label: "Schedule",
    icon: <CalendarClock className="h-4 w-4" />,
  },
];

export function OverflowActionsPreview() {
  const [expanded, setExpanded] = useState(false);

  return (
    <div className="flex w-full items-center justify-center">
      <OverflowActions
        primaryActions={primaryActions}
        overflowActions={overflowActions}
        expanded={expanded}
        onExpandedChange={setExpanded}
        openLabel="Open action rail"
        closeLabel="Collapse action rail"
      />
    </div>
  );
}

API Reference

OverflowActions

Prop Type Default Required Description
primaryActions OverflowActionItem[] — Yes —
overflowActions OverflowActionItem[] — Yes —
expanded boolean — No —
defaultExpanded boolean false No —
onExpandedChange ((expanded: boolean) => void) — No —
onAction ((item: OverflowActionItem) => void) — No —
collapseOnAction boolean false No —
size "sm" | "md" md No —
openLabel string Show extra actions No —
closeLabel string Hide extra actions No —
className string — No —
classNames OverflowActionsClassNames — No —

Browse this category