status
diceui-radix/statusFreeComponent
diceui/radix publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/sadmann7/diceui/HEAD/docs/public/r/styles/radix-nova/status.jsonSource
1import { cva, type VariantProps } from "class-variance-authority";2import { Slot as SlotPrimitive } from "radix-ui";3import type * as React from "react";4import { cn } from "@/lib/utils";56const statusVariants = cva(7 "inline-flex w-fit shrink-0 items-center gap-1.5 overflow-hidden whitespace-nowrap rounded-full border px-2.5 py-1 font-medium text-xs transition-colors",8 {9 variants: {10 variant: {11 default:12 "border-transparent bg-muted text-muted-foreground **:data-[slot=status-indicator]:bg-muted-foreground",13 success:14 "border-green-500/20 bg-green-500/10 text-green-600 **:data-[slot=status-indicator]:bg-green-600 dark:text-green-400 **:data-[slot=status-indicator]:dark:bg-green-400",15 error:16 "border-destructive/20 bg-destructive/10 text-destructive **:data-[slot=status-indicator]:bg-destructive",17 warning:18 "border-orange-500/20 bg-orange-500/10 text-orange-600 **:data-[slot=status-indicator]:bg-orange-600 dark:text-orange-400 **:data-[slot=status-indicator]:dark:bg-orange-400",19 info: "border-blue-500/20 bg-blue-500/10 text-blue-600 **:data-[slot=status-indicator]:bg-blue-600 dark:text-blue-400 **:data-[slot=status-indicator]:dark:bg-blue-400",20 },21 },22 defaultVariants: {23 variant: "default",24 },25 },26);2728interface StatusProps29 extends VariantProps<typeof statusVariants>,30 React.ComponentProps<"div"> {31 asChild?: boolean;32}3334function Status(props: StatusProps) {35 const { className, variant = "default", asChild, ...rootProps } = props;3637 const RootPrimitive = asChild ? SlotPrimitive.Slot : "div";3839 return (40 <RootPrimitive41 data-slot="status"42 data-variant={variant}43 {...rootProps}44 className={cn(statusVariants({ variant }), className)}45 />46 );47}4849function StatusIndicator(props: React.ComponentProps<"div">) {50 const { className, ...indicatorProps } = props;5152 return (53 <div54 data-slot="status-indicator"55 {...indicatorProps}56 className={cn(57 "relative flex size-2 shrink-0 rounded-full",58 "before:absolute before:inset-0 before:animate-ping before:rounded-full before:bg-inherit",59 "after:absolute after:inset-[2px] after:rounded-full after:bg-inherit",60 className,61 )}62 />63 );64}6566function StatusLabel(props: React.ComponentProps<"div">) {67 const { className, ...labelProps } = props;6869 return (70 <div71 data-slot="status-label"72 {...labelProps}73// … truncated
What it pulls in
npm packages
Files it writes
More from diceui/radix
All 58 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| action-baraction-bar | diceui/radix | Components | Free | 1 dep · 2 files | |
| angle-sliderangle-slider | diceui/radix | Components | Free | 1 dep · 3 files | |
| avatar-groupavatar-group | diceui/radix | Components | Free | 1 dep | |
| badge-overflowbadge-overflow | diceui/radix | Components | Free | 1 dep · 2 files | |
| bannerbanner | diceui/radix | Components | Free | 1 dep | |
| checkbox-groupcheckbox-group | diceui/radix | Components | Free | 1 dep | |
| circular-progresscircular-progress | diceui/radix | Components | Free | 1 dep | |
| client-onlyclient-only | diceui/radix | Components | Free | no deps |
