{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "badge", "title": "Badge", "description": "Polaris-styled Badge component.", "dependencies": [], "devDependencies": [ "@shopify/polaris-types" ], "registryDependencies": [ "@polaris-shadcn/theme", "@polaris-shadcn/utils" ], "files": [ { "path": "registry/templates/components/ui/badge.tsx", "content": "import * as React from \"react\";\nimport { cn } from \"../../lib/utils\";\n\ntype SBadgeProps = React.ComponentPropsWithoutRef<\"s-badge\">;\n\nexport type BadgeVariant =\n | \"default\"\n | \"secondary\"\n | \"outline\"\n | \"success\"\n | \"warning\"\n | \"destructive\";\n\nexport interface BadgeProps extends React.ComponentPropsWithoutRef<\"s-badge\"> {\n variant?: BadgeVariant;\n className?: string;\n}\n\nconst toneMap: Record<\n BadgeVariant,\n {\n tone: SBadgeProps[\"tone\"];\n color: NonNullable | \"subdued\";\n }\n> = {\n default: { tone: \"info\", color: \"subdued\" },\n secondary: { tone: \"info\", color: \"subdued\" },\n outline: { tone: \"info\", color: \"subdued\" },\n success: { tone: \"success\", color: \"strong\" },\n warning: { tone: \"warning\", color: \"strong\" },\n destructive: { tone: \"critical\", color: \"strong\" },\n};\n\nconst Badge = React.forwardRef(\n ({ className, variant = \"default\", ...props }, ref) => {\n const polarisTone = toneMap[variant] ?? toneMap.default;\n return (\n \n );\n },\n);\nBadge.displayName = \"Badge\";\n\nexport { Badge };\n", "type": "registry:ui" } ], "type": "registry:ui" }