Faber UI
Components

Button

Displays a button or a button-styled link with multiple variants and sizes.

Button is built on the Base UI Button primitive and exposes a shadcn-compatible variant API through class-variance-authority. It supports a render prop for composition (the Base UI equivalent of asChild).

Installation

Terminal
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/button.json

Usage

typescript
import { Button } from "@/components/ui/button";

export default function Example() {
  return <Button>Button</Button>;
}

Examples

Variants

Prop

Type

Sizes

With an icon

Buttons automatically size and space child SVG icons. Drop a Remixicon component inside:

typescript
import { RiArrowRightLine } from "@remixicon/react";
import { Button } from "@/components/ui/button";

export default function Example() {
  return (
    <Button>
      Continue
      <RiArrowRightLine />
    </Button>
  );
}

Navigation belongs on a link, not a button, so apply buttonVariants to the link itself. Base UI's Button enforces button semantics, which a link must not take on.

typescript
import Link from "next/link";
import { buttonVariants } from "@/lib/button-variants";

export default function Example() {
  return (
    <Link href="/docs" className={buttonVariants()}>
      Go to docs
    </Link>
  );
}

Disabled

API

Button

Prop

Type

The component also accepts all native button element props.

Changelog

  1. v0.3.0Button, Toggle, Tabs and NavigationMenu ship their style configs from @workspace/ui/lib/*-variants so component files export only components.minor
  2. v0.3.0Button presses scale to --scale-press with the press utility instead of shifting down a pixel.patch
  3. v0.3.0The dark variant matches with zero specificity, so hover and state classes such as hover:bg-input/50 on the outline Button also apply in dark mode.patch
  4. v0.1.0Accessibility, correctness, and token fixes across the kit, from a full code-smell audit.minor
Full Button history

Last updated on

On this page