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
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/button.jsonUsage
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:
import { RiArrowRightLine } from "@remixicon/react";
import { Button } from "@/components/ui/button";
export default function Example() {
return (
<Button>
Continue
<RiArrowRightLine />
</Button>
);
}As a link
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.
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
- v0.3.0Button, Toggle, Tabs and NavigationMenu ship their style configs from @workspace/ui/lib/*-variants so component files export only components.minor
- v0.3.0Button presses scale to --scale-press with the press utility instead of shifting down a pixel.patch
- 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
- v0.1.0Accessibility, correctness, and token fixes across the kit, from a full code-smell audit.minor
Last updated on