{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "button",
  "title": "Button",
  "description": "Native buttons and links for Astro actions, with size, variant, and loading styles.",
  "dependencies": [
    "class-variance-authority",
    "cn"
  ],
  "registryDependencies": [
    "@gnostic/spinner"
  ],
  "files": [
    {
      "path": "packages/ui/src/components/ui/button/button-variants.ts",
      "content": "import { cva, type VariantProps } from 'class-variance-authority'\n\nexport const buttonVariants = cva(\n    \"font-sans focus-visible:ring-ring focus-visible:ring-offset-background relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-lg border text-base font-medium whitespace-nowrap transition-shadow outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] focus-visible:ring-2 focus-visible:ring-offset-1 disabled:opacity-64 sm:text-sm pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 group/button disabled:pointer-events-none data-loading:text-transparent data-loading:select-none\",\n    {\n        compoundVariants: [\n            {\n                variant: 'outline',\n                size: ['icon', 'icon-xs', 'icon-sm', 'icon-lg', 'icon-xl'],\n                class: \"\",\n            },\n        ],\n        defaultVariants: {\n            size: 'default',\n            variant: 'default',\n        },\n        variants: {\n            size: {\n                default: \"h-9 px-[calc(--spacing(3)-1px)] sm:h-8\",\n                icon: \"size-9 sm:size-8\",\n                'icon-lg': \"size-10 sm:size-9\",\n                'icon-sm': \"size-8 sm:size-7\",\n                'icon-xl': \"size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5\",\n                'icon-xs': \"size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5\",\n                lg: \"h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9\",\n                sm: \"h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7\",\n                xl: \"h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5\",\n                xs: \"h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5\",\n            },\n            variant: {\n                glass: \"border-white/24 border bg-white/14 text-white hover:bg-white/18 before:bg-white/0 relative backdrop-blur-sm before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:transition-[background-color] before:duration-300 before:ease-in-out hover:before:bg-white/8\",\n                surface: \"border-border bg-card text-card-foreground hover:bg-accent\",\n                'destructive-outline':\n                    \"border-input bg-popover text-destructive-foreground hover:border-destructive/32 hover:bg-destructive/4 data-pressed:border-destructive/32 data-pressed:bg-destructive/4 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 shadow-xs/5 not-dark:bg-clip-padding not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n                default: \"border-primary bg-primary text-primary-foreground shadow-primary/24 hover:bg-primary/90 data-pressed:bg-primary/90 *:data-[slot=button-loading-indicator]:text-primary-foreground shadow-xs not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n                destructive: \"border-destructive bg-destructive shadow-destructive/24 hover:bg-destructive/90 data-pressed:bg-destructive/90 text-white shadow-xs not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] *:data-[slot=button-loading-indicator]:text-white [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n                ghost: \"text-foreground hover:bg-accent data-pressed:bg-accent *:data-[slot=button-loading-indicator]:text-foreground border-transparent\",\n                link: \"text-foreground *:data-[slot=button-loading-indicator]:text-foreground border-transparent underline-offset-4 hover:underline data-pressed:underline\",\n                outline: \"border-input bg-popover text-foreground hover:bg-accent/50 data-pressed:bg-accent/50 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:data-pressed:bg-input/64 dark:hover:bg-input/64 shadow-xs/5 not-dark:bg-clip-padding not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none\",\n                secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/90 data-pressed:bg-secondary/90 *:data-[slot=button-loading-indicator]:text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80 border-transparent\",\n            },\n        },\n    },\n)\n\nexport type ButtonVariantProps = VariantProps<typeof buttonVariants>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/button/button-variants.ts"
    },
    {
      "path": "packages/ui/src/components/ui/button/button.astro",
      "content": "---\nimport type { HTMLTag, Polymorphic } from \"astro/types\"\nimport { Spinner } from \"../spinner\"\n\nimport { cn } from \"cn\"\n\nimport { buttonVariants } from \"./button-variants\"\nimport type { ButtonProps } from \"./types\"\n\ntype Props<Tag extends HTMLTag = \"button\"> = Polymorphic<{ as: Tag }> &\n  ButtonProps\n\nconst {\n  as: Tag = \"href\" in Astro.props ? \"a\" : \"button\",\n  class: className,\n  variant = \"default\",\n  size = \"default\",\n  withLoader = false,\n  ...props\n} = Astro.props\n\n// Props validates the selected tag at the call site. The render tag is dynamic.\nconst elementProps: Record<string, unknown> = {\n  ...(Tag === \"button\" ? { type: \"button\" as const } : {}),\n  ...props,\n}\n---\n\n<Tag\n  data-slot=\"button\"\n  data-variant={variant}\n  data-size={size}\n  class={cn(buttonVariants({ variant, size }), className)}\n  {...elementProps}\n>\n  <slot />\n  <slot name=\"button-loading-indicator\">\n    {withLoader && (\n      <Spinner\n        data-slot=\"button-loading-indicator\"\n        class=\"absolute not-in-data-loading:hidden\"\n      />\n    )}\n  </slot>\n</Tag>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/button/button.astro"
    },
    {
      "path": "packages/ui/src/components/ui/button/index.ts",
      "content": "export { buttonVariants, type ButtonVariantProps } from \"./button-variants\"\n\nexport { default as Button } from \"./button.astro\"\n",
      "type": "registry:file",
      "target": "~/src/components/ui/button/index.ts"
    },
    {
      "path": "packages/ui/src/components/ui/button/types.ts",
      "content": "import type { HTMLTag } from 'astro/types'\n\nimport type { ButtonVariantProps } from './button-variants'\n\nexport interface ButtonProps extends ButtonVariantProps {\n    /**\n     * The HTML tag to render the button as.\n     *\n     * @default 'button'\n     */\n    as?: HTMLTag\n    /**\n     * Add the built-in loading indicator. It will remain hidden until the button's `data-loading` attribute is set to `true`.\n     *\n     * @default false\n     */\n    withLoader?: boolean\n}\n",
      "type": "registry:file",
      "target": "~/src/components/ui/button/types.ts"
    }
  ],
  "meta": {
    "framework": "astro",
    "source": "@gnostic/ui",
    "testedDependencies": {
      "class-variance-authority": "^0.7.1",
      "cn": "0.5.2"
    }
  },
  "docs": "https://ui.gnosticai.com/components/button",
  "categories": [
    "ui"
  ],
  "type": "registry:ui"
}
