{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "button", "title": "Button", "description": "Polaris-styled Button component.", "dependencies": [], "devDependencies": [ "@shopify/polaris-types" ], "registryDependencies": [ "@polaris-shadcn/theme" ], "files": [ { "path": "registry/templates/components/ui/button.tsx", "content": "import * as React from \"react\";\n\ntype SButtonProps = React.ComponentPropsWithoutRef<\"s-button\">;\n\nexport type ButtonVariant =\n | \"default\"\n | \"secondary\"\n | \"outline\"\n | \"ghost\"\n | \"link\"\n | \"destructive\";\n\nexport type ButtonTone = \"auto\" | \"success\" | \"critical\" | \"neutral\";\n\nexport type ButtonIconType = React.ComponentPropsWithoutRef<\"s-icon\">[\"type\"];\n\nexport interface ButtonProps extends Omit {\n className?: string;\n variant?: ButtonVariant;\n tone?: ButtonTone;\n icon?: ButtonIconType;\n loading?: boolean;\n accessibilityLabel?: string;\n}\n\n// Maps our variant prop to s-button's variant prop\nconst variantMap: Record = {\n default: \"primary\",\n secondary: \"secondary\",\n outline: \"secondary\",\n ghost: \"tertiary\",\n link: \"tertiary\",\n destructive: \"primary\",\n};\n\n// Maps our tone prop to s-button's tone prop\nconst toneMap: Record = {\n auto: \"auto\",\n success: \"auto\", // s-button doesn't have success tone, use auto\n critical: \"critical\",\n neutral: \"neutral\",\n};\n\nconst Button = React.forwardRef(\n (\n {\n className,\n variant = \"default\",\n tone = \"auto\",\n disabled,\n loading,\n type,\n icon,\n accessibilityLabel,\n children,\n ...props\n },\n ref,\n ) => {\n // Map variant to s-button variant\n const resolvedVariant = variantMap[variant] ?? \"primary\";\n\n // Destructive variant uses critical tone\n const resolvedTone =\n variant === \"destructive\" && tone === \"auto\"\n ? \"critical\"\n : toneMap[tone] ?? \"auto\";\n\n const resolvedType = type ?? \"button\";\n\n return (\n \n {children}\n \n );\n },\n);\nButton.displayName = \"Button\";\n\nexport { Button };\n", "type": "registry:ui" } ], "type": "registry:ui" }