Componentfeedback0.48 KB gzipZero dependencies
Role Badge
Role badge set: admin, editor, member, viewer with distinct tones.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add role-badgeOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { RoleBadge } from "@/components/ui/role-badge"; <RoleBadge />Source code
role-badge.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxrole-badge.tsx40 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export type RoleTone = "admin" | "editor" | "member" | "viewer" | "custom"; export interface RoleBadgeProps extends React.HTMLAttributes<HTMLSpanElement> { role: RoleTone; label?: string;} const TONE: Record<RoleTone, string> = { admin: "border-accent/60 bg-accent/10 text-accent", editor: "border-info/50 bg-info/10 text-info", member: "border-border bg-secondary text-secondary-foreground", viewer: "border-border/60 bg-transparent text-muted-foreground", custom: "border-dashed border-border bg-transparent text-foreground",Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { RoleBadge } from "@/components/ui/role-badge"; <RoleBadge />| Prop | Type | Description |
|---|---|---|
| role | RoleTone | Configures role. |
| label | string | Accessible label text rendered or attached to the control. |