Components
Button
A versatile button component with multiple variants, sizes, shapes, morphing press feedback, loading state, and ripple.
import { Button } from "@/components/ui/button";
export default function Particle() {
return <Button>Button</Button>;
}
Installation
pnpm dlx shadcn@latest add @taut-ui/button
Usage
import { Button } from "@/components/ui/button"<Button>Button</Button>Examples
Secondary
import { Button } from "@/components/ui/button";
export default function Particle() {
return <Button variant="secondary">Secondary</Button>;
}
Elevated
import { Button } from "@/components/ui/button";
export default function Particle() {
return <Button variant="elevated">Elevated</Button>;
}
Outline
import { Button } from "@/components/ui/button";
export default function Particle() {
return <Button variant="outline">Outline</Button>;
}
Ghost
import { Button } from "@/components/ui/button";
export default function Particle() {
return <Button variant="ghost">Ghost</Button>;
}
Destructive
import { Button } from "@/components/ui/button";
export default function Particle() {
return <Button variant="destructive">Delete</Button>;
}
With Icon
import { MailIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
export default function Particle() {
return (
<Button>
<MailIcon />
Send email
</Button>
);
}
Icon Only
import { PlusIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
export default function Particle() {
return (
<Button aria-label="Add item" size="icon" variant="secondary">
<PlusIcon />
</Button>
);
}
Loading
import { Button } from "@/components/ui/button";
export default function Particle() {
return <Button loading>Saving</Button>;
}
Morph & Selected
"use client";
import { HeartIcon } from "lucide-react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
export default function Particle() {
const [selected, setSelected] = useState(false);
return (
<Button
morph
onClick={() => setSelected((prev) => !prev)}
selected={selected}
variant="secondary"
>
<HeartIcon className={selected ? "fill-current" : undefined} />
Favorite
</Button>
);
}
As Link
"use client";
import { ArrowUpRightIcon } from "lucide-react";
import Link from "next/link";
import { Button } from "@/components/ui/button";
export default function Particle() {
return (
<Button
render={
<Link
href="#as-link"
onClick={(e) => e.preventDefault()}
prefetch={false}
/>
}
variant="outline"
>
Documentation
<ArrowUpRightIcon />
</Button>
);
}
API Reference
Button
Renders an interactive button element with ripple feedback, optional shape morphing, and polymorphic rendering via Base UI useRender.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "filled" | "secondary" | "tonal" | "elevated" | "outline" | "ghost" | "text" | "link" | "destructive" | "destructive-outline" | "default" | Visual style variant |
size | "xs" | "sm" | "default" | "md" | "lg" | "xl" | "icon-xs" | "icon-sm" | "icon" | "icon-md" | "icon-lg" | "icon-xl" | "default" | Size of the button, controlling height, padding, and icon sizing |
width | "narrow" | "wide" | - | Adjusts the width of icon-only buttons |
shape | "round" | "square" | "round" | Base corner radius shape |
morph | boolean | false | Enables spring corner morphing on press and when selected |
selected | boolean | - | Sets aria-pressed and data-selected for toggleable buttons |
loading | boolean | false | Shows a centered Spinner and disables interaction while true |
disabled | boolean | false | Disables the button natively and sets aria-disabled |
render | React.ReactElement | ((props, state) => React.ReactElement) | - | Custom element to render (e.g. <Link /> or <a />) |
className | string | - | Additional CSS classes |
...props | React.ComponentProps<"button"> | - | All standard button attributes are supported |
buttonVariants
A cva helper exported for composing button variant styles on custom elements (pair with tautSize for sizing).
import { cn } from "@/lib/utils"
import { tautSize } from "@/lib/morph"
import { buttonVariants } from "@/components/ui/button"
<a
className={cn(buttonVariants({ variant: "outline" }), tautSize({ size: "sm" }))}
href="/docs"
>
Read the docs
</a>