Skip to content

Actions

Button

tsx
import { Button } from "@cherry-design-system/react";

export function Save() {
  return <Button>Save changes</Button>;
}

A native <button> for actions such as saving, submitting or opening a dialog. Use IconButton for icon-only actions and Link for navigation.

Button ships no client JavaScript, so it renders in React Server Components.

Examples

Variants

tsx
import { Button } from "@cherry-design-system/react";

export function Variants() {
  return (
    <>
      <Button variant="primary">Primary</Button>
      <Button variant="secondary">Secondary</Button>
      <Button variant="outline">Outline</Button>
      <Button variant="ghost">Ghost</Button>
      <Button variant="accent">Accent</Button>
    </>
  );
}

Sizes

sm, md and lg are 32, 36 and 44 px tall.

tsx
import { Button } from "@cherry-design-system/react";

export function Sizes() {
  return (
    <>
      <Button size="sm">Small</Button>
      <Button size="md">Medium</Button>
      <Button size="lg">Large</Button>
    </>
  );
}

With icons

tsx
import { Button } from "@cherry-design-system/react";
import { ArrowRight, Plus } from "lucide-react";

export function WithIcons() {
  return (
    <>
      <Button leadingIcon={<Plus />}>New project</Button>
      <Button variant="outline" trailingIcon={<ArrowRight />}>
        Continue
      </Button>
    </>
  );
}

Loading

loading shows a spinner in place of the leading icon, sets aria-busy and blocks clicks while keeping the label readable.

tsx
import { Button } from "@cherry-design-system/react";

export function Saving({ pending }: { pending: boolean }) {
  return (
    <Button type="submit" loading={pending}>
      {pending ? "Saving" : "Save"}
    </Button>
  );
}

Full width

tsx
import { Button } from "@cherry-design-system/react";

export function SignIn() {
  return (
    <Button type="submit" size="lg" fullWidth>
      Sign in
    </Button>
  );
}

Properties

variant"accent" | "primary" | "outline" | "secondary" | "ghost"

Visual style. Defaults to "primary".

size"sm" | "md" | "lg"

32 / 36 / 44 px. Defaults to "md".

leadingIconReactNode

Icon before the label, for example a lucide icon element.

trailingIconReactNode

Icon after the label.

fullWidthboolean

Stretch to the container width.

loadingboolean

Shows a spinner in place of the leading icon, sets aria-busy and blocks clicks.

Renders a <button> and forwards its ref to it. All native <button> attributes pass through. type defaults to "button", so pass type="submit" inside forms.

Styling

Root class cherry-button with data-variant (primary, secondary, outline, ghost, accent) and data-size (sm, md, lg). State attributes: data-loading, data-full-width, plus disabled. Parts: cherry-button__label, cherry-button__icon.

Colors come from the --cherry-primary-*, --cherry-secondary-*, --cherry-accent-* and --cherry-ghost-hover tokens; the focus ring uses --cherry-ring.

Accessibility

Native <button> with a visible focus ring. loading sets aria-busy and keeps the label readable. Icons are hidden from assistive tech, so the text label is the accessible name. For icon-only actions use IconButton.