Skip to content
Sign in
SafetyRisk badgeMenu

Risk badgePro

Low, medium and high risk action badges with a distinct glyph per level.

ProA payment plan with each step rated; point at a badge for why.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/risk-badge

Usage

tsx
import { RiskBadge } from "@/components/ui/chatcn/pro/risk-badge"

<RiskBadge level="high" reason="Moves money and cannot be pulled back." factors={["Spends money", "Cannot be undone"]} />

Each level has its own shape, the ones road signs taught everyone: a circle for low, a triangle for medium, an octagon for high. The level reads in grayscale, forced colors and for color blind people; green, amber and red are tints only. With reason or factors, the badge explains the call so people learn what makes an action risky.

Examples

States

ProThree sizes, glyph only and in a sentence.

Props

PropTypeNotes
level"low" | "medium" | "high"
size"sm" | "md" | "lg"Default md
variant"badge" | "glyph"glyph is the shape alone, labelled
reason, factorsReactNode, string[]Adds a popover
labelstringOverride the word, for translation

Keyboard

KeyAction
Enter or SpaceOpen the reason
EscClose it

Accessibility

  • The word is always present: visible in the badge, or as the image label for glyph.
  • Forced colors swap the tint for an outline.

Motion

The popover grows from the badge in 180 ms. Nothing else moves.