status
diceui-base/statusFreeComponent
diceui/base publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/sadmann7/diceui/HEAD/docs/public/r/styles/base-vega/status.jsonSource
1import { mergeProps } from "@base-ui/react/merge-props";2import { useRender } from "@base-ui/react/use-render";3import { cva, type VariantProps } from "class-variance-authority";4import type * as React from "react";5import { cn } from "@/lib/utils";67const statusVariants = cva(8 "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",9 {10 variants: {11 variant: {12 default:13 "border-transparent bg-muted text-muted-foreground **:data-[slot=status-indicator]:bg-muted-foreground",14 success:15 "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",16 error:17 "border-destructive/20 bg-destructive/10 text-destructive **:data-[slot=status-indicator]:bg-destructive",18 warning:19 "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",20 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",21 },22 },23 defaultVariants: {24 variant: "default",25 },26 },27);2829interface StatusProps30 extends VariantProps<typeof statusVariants>,31 React.ComponentProps<"div">,32 useRender.ComponentProps<"div"> {}3334function Status(props: StatusProps) {35 const { className, variant = "default", render, ...rootProps } = props;3637 return useRender({38 defaultTagName: "div",39 props: mergeProps<"div">(40 {41 className: cn(statusVariants({ variant }), className),42 },43 rootProps,44 ),45 render,46 state: {47 slot: "status",48 variant,49 },50 });51}5253function StatusIndicator(props: React.ComponentProps<"div">) {54 const { className, ...indicatorProps } = props;5556 return (57 <div58 data-slot="status-indicator"59 {...indicatorProps}60 className={cn(61 "relative flex size-2 shrink-0 rounded-full",62 "before:absolute before:inset-0 before:animate-ping before:rounded-full before:bg-inherit",63 "after:absolute after:inset-[2px] after:rounded-full after:bg-inherit",64 className,65 )}66 />67 );68}6970function StatusLabel(props: React.ComponentProps<"div">) {71// … truncated
What it pulls in
npm packages
Files it writes
More from diceui/base
All 192 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| action-baraction-bar | diceui/base | Components | Free | 1 dep | |
| angle-sliderangle-slider | diceui/base | Components | Free | 1 dep · 3 files | |
| avatar-groupavatar-group | diceui/base | Components | Free | 1 dep | |
| badge-overflowbadge-overflow | diceui/base | Components | Free | 1 dep · 2 files | |
| bannerbanner | diceui/base | Components | Free | 1 dep | |
| circular-progresscircular-progress | diceui/base | Components | Free | 1 dep | |
| client-onlyclient-only | diceui/base | Components | Free | no deps | |
| color-pickercolor-picker | diceui/base | Components | Free | 1 dep · 2 files |
