Button

Filled, tinted, gray, bordered, plain, glass and destructive buttons in the five control sizes — a 34 pt capsule on iOS 26, a 24 pt rounded rectangle on macOS 26, apple.com’s 36 px pill on the web.

controls

Apple: Buttons

· Base UI: Button

Styles

import { Button } from "@applecn/ui/components/button"

export default function ButtonStyles() {
  return (
    <div className="flex flex-wrap items-center gap-3">
      <Button>Filled</Button>
      <Button variant="tinted">Tinted</Button>
      <Button variant="gray">Gray</Button>
      <Button variant="bordered">Bordered</Button>
      <Button variant="plain">Plain</Button>
      <Button variant="destructive">Delete</Button>
      <Button variant="link">Learn More</Button>
      <div className="flex gap-3 rounded-4xl bg-[linear-gradient(135deg,var(--system-purple),var(--system-pink))] p-4">
        <Button variant="glass">Glass</Button>
        <Button variant="glass-prominent">Prominent</Button>
      </div>
    </div>
  )
}

Sizes

import { Button } from "@applecn/ui/components/button"

export default function ButtonSizes() {
  return (
    <div className="flex flex-wrap items-end gap-3">
      <Button size="mini">Mini</Button>
      <Button size="small">Small</Button>
      <Button size="regular">Regular</Button>
      <Button size="large">Large</Button>
      <Button size="xl">Extra Large</Button>
    </div>
  )
}

Shapes and icons

import { Add01Icon, Share01Icon } from "@hugeicons/core-free-icons"

import { Button } from "@applecn/ui/components/button"
import { Icon } from "@applecn/ui/components/icon"

export default function ButtonShapes() {
  return (
    <div className="flex flex-wrap items-center gap-3">
      <Button shape="capsule">
        <Icon icon={Share01Icon} /> Share
      </Button>
      <Button shape="rounded" variant="tinted">
        Rounded
      </Button>
      <Button shape="circle" variant="gray" aria-label="Add">
        <Icon icon={Add01Icon} weight="semibold" />
      </Button>
      <Button shape="circle" size="small" variant="tinted" aria-label="Share">
        <Icon icon={Share01Icon} />
      </Button>
      <Button disabled>Disabled</Button>
    </div>
  )
}

Install

From the registry this site publishes, with dependencies resolved by the CLI.

npx shadcn@latest add https://applecn.vercel.app/r/button.json

Source

packages/ui/src/components/button.tsx

"use client"

import { Button as ButtonPrimitive } from "@base-ui/react/button"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"

/**
 * Buttons (HIG › Buttons). `variant` is the style — filled/prominent, tinted, gray, bordered,
 * plain, glass, glass-prominent, destructive, link — `size` one of the five control sizes, and
 * `shape` the outline. Every size reads its height, corner, padding and label size from the
 * platform tokens, so the same button is a 34 pt capsule on iOS 26, a 24 pt rounded rectangle
 * on macOS 26 (a capsule from the large size, as AppKit does) and apple.com's 36 px pill on the
 * web. `shape="automatic"` (the default) is that platform shape; `capsule`, `rounded` and
 * `circle` (icon-only) force one. Every button has a press state and dims to 40 % when
 * disabled.
 */
const buttonVariants = cva(
  "group/button inline-flex shrink-0 items-center justify-center gap-1.5 border border-transparent bg-clip-padding leading-none font-semibold whitespace-nowrap transition-[background-color,transform,opacity,box-shadow,color] duration-(--duration-press) ease-(--ease-standard) outline-none select-none focus-visible:ring-4 focus-visible:ring-ring/60 active:scale-[0.97] active:opacity-80 disabled:pointer-events-none disabled:opacity-40 aria-invalid:ring-3 aria-invalid:ring-destructive/30 motion-reduce:active:scale-100 macos:font-normal macos:active:scale-100 web:font-normal web:active:scale-100 [&_svg]:pointer-events-none [&_svg]:shrink-0",
  {
    variants: {
      variant: {
        filled:
          "bg-primary text-primary-foreground hover:bg-[color-mix(in_srgb,var(--primary),black_8%)] macos:shadow-control web:hover:bg-[color-mix(in_srgb,var(--primary),white_6%)]",
        tinted: "bg-primary/15 text-primary hover:bg-primary/20",
        gray: "bg-fill-3 text-primary hover:bg-fill-2 macos:bg-background-3 macos:text-label macos:shadow-control macos:hover:bg-background-3 web:text-label web:hover:bg-fill-2",
        bordered:
          "border-border bg-transparent text-primary hover:bg-fill-4 macos:border-transparent macos:bg-background-3 macos:text-label macos:shadow-control web:border-label web:text-label web:hover:bg-label web:hover:text-background",
        plain: "bg-transparent text-primary hover:bg-fill-4",
        glass: "glass text-foreground",
        "glass-prominent": "glass-prominent",
        destructive:
          "bg-destructive/15 text-destructive hover:bg-destructive/20",
        link: "bg-transparent text-link underline-offset-4 hover:underline",
      },
      size: {
        mini: "h-(--control-height-mini) gap-1 rounded-(--control-radius-mini) px-(--control-padding-x-mini) text-[length:var(--control-font-mini)]",
        small:
          "h-(--control-height-small) rounded-(--control-radius-small) px-(--control-padding-x-small) text-[length:var(--control-font-small)]",
        regular:
          "h-(--control-height-regular) rounded-(--control-radius-regular) px-(--control-padding-x-regular) text-[length:var(--control-font-regular)]",
        large:
          "h-(--control-height-large) rounded-(--control-radius-large) px-(--control-padding-x-large) text-[length:var(--control-font-large)]",
        xl: "h-(--control-height-xl) rounded-(--control-radius-xl) px-(--control-padding-x-xl) text-[length:var(--control-font-xl)]",
      },
      shape: {
        automatic: "",
        capsule: "rounded-full",
        rounded: "rounded-lg",
        circle: "aspect-square rounded-full px-0",
      },
    },
    defaultVariants: {
      variant: "filled",
      size: "regular",
      shape: "automatic",
    },
  }
)

type ButtonProps = ButtonPrimitive.Props & VariantProps<typeof buttonVariants>

function Button({
  className,
  variant = "filled",
  size = "regular",
  shape = "automatic",
  ...props
}: ButtonProps) {
  return (
    <ButtonPrimitive
      data-slot="button"
      data-variant={variant}
      data-size={size}
      data-shape={shape}
      className={cn(buttonVariants({ variant, size, shape }), className)}
      {...props}
    />
  )
}

export { Button, buttonVariants }
export type { ButtonProps }