apps/eclipse/content/design-system/components/action.mdx
import { Action } from "@prisma/eclipse"; import { Command, Heart, Star, Zap, CheckCircle, AlertTriangle, Info } from "lucide-react";
Basic Action
import { Action } from "@prisma/eclipse";
import { Command } from "lucide-react";
export function BasicAction() {
return (
<Action color="neutral" size="lg">
<Command />
</Action>
);
}
Live Example:
<div className="flex gap-4 my-4"> <Action color="neutral" size="lg"> <Command /> </Action> </div>Color Variants
The Action component supports multiple color variants:
import { Action } from "@prisma/eclipse";
import { Command } from "lucide-react";
export function ColorVariants() {
return (
<div className="flex flex-wrap gap-4">
<Action color="ppg" size="2xl">
<Command />
</Action>
<Action color="orm" size="2xl">
<Command />
</Action>
<Action color="error" size="2xl">
<Command />
</Action>
<Action color="success" size="2xl">
<Command />
</Action>
<Action color="warning" size="2xl">
<Command />
</Action>
<Action color="neutral" size="2xl">
<Command />
</Action>
</div>
);
}
Live Example:
<div className="flex flex-wrap gap-4 my-4"> <Action color="ppg" size="2xl"> <Command /> </Action> <Action color="orm" size="2xl"> <Command /> </Action> <Action color="error" size="2xl"> <Command /> </Action> <Action color="success" size="2xl"> <Command /> </Action> <Action color="warning" size="2xl"> <Command /> </Action> <Action color="neutral" size="2xl"> <Command /> </Action> </div>Extended Color Palette
Additional color options for more variety:
import { Action } from "@prisma/eclipse";
import { Heart, Star, Zap } from "lucide-react";
export function ExtendedColors() {
return (
<div className="flex flex-wrap gap-4">
<Action color="cyan" size="2xl">
<Heart />
</Action>
<Action color="fuchsia" size="2xl">
<Star />
</Action>
<Action color="lime" size="2xl">
<Zap />
</Action>
<Action color="pink" size="2xl">
<Heart />
</Action>
<Action color="purple" size="2xl">
<Star />
</Action>
<Action color="sky" size="2xl">
<Zap />
</Action>
<Action color="violet" size="2xl">
<Heart />
</Action>
<Action color="yellow" size="2xl">
<Star />
</Action>
</div>
);
}
Live Example:
<div className="flex flex-wrap gap-4 my-4"> <Action color="cyan" size="2xl"> <Heart /> </Action> <Action color="fuchsia" size="2xl"> <Star /> </Action> <Action color="lime" size="2xl"> <Zap /> </Action> <Action color="pink" size="2xl"> <Heart /> </Action> <Action color="purple" size="2xl"> <Star /> </Action> <Action color="sky" size="2xl"> <Zap /> </Action> <Action color="violet" size="2xl"> <Heart /> </Action> <Action color="yellow" size="2xl"> <Star /> </Action> </div>Size Variants
The Action component comes in four sizes:
import { Action } from "@prisma/eclipse";
import { Command } from "lucide-react";
export function SizeVariants() {
return (
<div className="flex items-center gap-4">
<Action color="ppg" size="lg">
<Command className="h-full w-full" />
</Action>
<Action color="ppg" size="2xl">
<Command className="h-full w-full" />
</Action>
<Action color="ppg" size="4xl">
<Command className="h-full w-full" />
</Action>
<Action color="ppg" size="5xl">
<Command className="h-full w-full" />
</Action>
</div>
);
}
Live Example:
<div className="flex items-center gap-4 my-4"> <Action color="ppg" size="lg"> <Command className="h-full w-full" /> </Action> <Action color="ppg" size="2xl"> <Command className="h-full w-full" /> </Action> <Action color="ppg" size="4xl"> <Command className="h-full w-full" /> </Action> <Action color="ppg" size="5xl"> <Command className="h-full w-full" /> </Action> </div>Framed Variant
Add a border to the Action container with the isFramed prop:
import { Action } from "@prisma/eclipse";
import { Command } from "lucide-react";
export function FramedAction() {
return (
<div className="flex flex-wrap gap-4">
<Action color="ppg" size="2xl" isFramed>
<Command />
</Action>
<Action color="orm" size="2xl" isFramed>
<Command />
</Action>
<Action color="error" size="2xl" isFramed>
<Command />
</Action>
<Action color="success" size="2xl" isFramed>
<Command />
</Action>
<Action color="warning" size="2xl" isFramed>
<Command />
</Action>
<Action color="neutral" size="2xl" isFramed>
<Command />
</Action>
</div>
);
}
Live Example:
<div className="flex flex-wrap gap-4 my-4"> <Action color="ppg" size="2xl" isFramed> <Command /> </Action> <Action color="orm" size="2xl" isFramed> <Command /> </Action> <Action color="error" size="2xl" isFramed> <Command /> </Action> <Action color="success" size="2xl" isFramed> <Command /> </Action> <Action color="warning" size="2xl" isFramed> <Command /> </Action> <Action color="neutral" size="2xl" isFramed> <Command /> </Action> </div>With Different Icons
Use any icon library like Lucide React:
import { Action } from "@prisma/eclipse";
import { CheckCircle, AlertTriangle, Info, Zap } from "lucide-react";
export function DifferentIcons() {
return (
<div className="flex flex-wrap gap-4">
<Action color="success" size="2xl">
<CheckCircle />
</Action>
<Action color="warning" size="2xl">
<AlertTriangle />
</Action>
<Action color="ppg" size="2xl">
<Info />
</Action>
<Action color="error" size="2xl">
<Zap />
</Action>
</div>
);
}
Live Example:
<div className="flex flex-wrap gap-4 my-4"> <Action color="success" className="bg-foreground" size="2xl"> <CheckCircle /> </Action> <Action color="warning" size="2xl"> <AlertTriangle /> </Action> <Action color="ppg" size="2xl"> <Info /> </Action> <Action color="error" size="2xl"> <Zap /> </Action> </div>Action
color - Color variant ("ppg" | "orm" | "error" | "success" | "warning" | "cyan" | "fuchsia" | "lime" | "pink" | "purple" | "sky" | "violet" | "yellow" | "neutral" | "neutral-reversed", default: "neutral")size - Size variant ("lg" | "2xl" | "4xl" | "5xl", default: "lg")isFramed - Whether to show a border (boolean, default: false)className - Additional CSS classes (string, optional)children - Icon or content to display (React.ReactNode)isFramed to add emphasis or distinguish from backgroundThe Action component is perfect for:
The Action component follows accessibility best practices:
The Action component uses design tokens:
bg-background-* tokensborder-stroke-* tokensrounded-square (6px)items-center justify-centerCustomize by passing className:
<Action className="shadow-lg hover:scale-110 transition-transform" color="ppg" size="2xl">
<Command className="h-5 w-5" />
</Action>