Decision Pill
delego/decision-pillFreeComponent
The signature Delego element: renders a Decision outcome (allow / needs_approval / deny) with its canonical icon, mono label, and color.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/Delego-Dev/registry/main/public/r/decision-pill.jsonSource
1import * as React from "react"2import { BadgeCheck, Clock, ShieldX } from "lucide-react"34import { cn } from "@/lib/utils"5import { StatusBadge } from "@/components/ui/status-badge"67// Decision pill — the signature Delego element. A delego Decision has exactly one8// of three outcomes; this renders it with the canonical icon + mono label + color9// so an outcome looks identical everywhere it appears. The default label is the10// protocol's own token (e.g. `needs_approval`); pass children to override.11type Decision = "allow" | "needs_approval" | "deny"1213const DECISION = {14 allow: { variant: "allow", icon: BadgeCheck, label: "allow" },15 needs_approval: { variant: "approval", icon: Clock, label: "needs_approval" },16 deny: { variant: "deny", icon: ShieldX, label: "deny" },17} as const1819function DecisionPill({20 decision,21 className,22 children,23 ...props24}: Omit<React.ComponentProps<typeof StatusBadge>, "variant"> & {25 decision: Decision26}) {27 const { variant, icon: Icon, label } = DECISION[decision]28 return (29 <StatusBadge30 variant={variant}31 data-decision={decision}32 className={cn(className)}33 {...props}34 >35 <Icon aria-hidden />36 {children ?? label}37 </StatusBadge>38 )39}4041export { DecisionPill, type Decision }
What it pulls in
npm packages
Other registry items
Files it writes
More from delego
All 6 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Buttonbutton | delego | Components | Free | 2 deps | |
| Fieldfield | delego | Components | Free | no deps | |
| Signed Receiptsigned-receipt | delego | Components | Free | 1 dep | |
| Status Badgestatus-badge | delego | Components | Free | 2 deps |
