Button
A versatile button component with multiple variants and sizes.
import { Button } from "@/components/ui/button/button";
export default function ButtonDemo() {
return <Button>Button</Button>;
}
npx shadcn@latest add @roiui/buttonnpx shadcn@latest add @roiui/button-tailwindanatomy
import { Button, Spinner, ArrowPointer } from "@/components/ui/button"
// Basic button
<Button>Click me</Button>
// With loading spinner
<Button disabled>
<Spinner />
Loading...
</Button>
// With arrow
<Button>
Continue
<ArrowPointer />
</Button>
// With external link arrow
<Button render={<a href="#" />}>
View External
<ArrowPointer pointExternal />
</Button>import { Button } from "@/components/ui/button/button";
export default function ButtonSecondary() {
return <Button variant="secondary">Secondary</Button>;
}
import { Button } from "@/components/ui/button/button";
export default function ButtonDestructive() {
return <Button variant="destructive">Destructive</Button>;
}
import { Button } from "@/components/ui/button/button";
export default function ButtonOutline() {
return <Button variant="outline">Outline</Button>;
}
import { Button } from "@/components/ui/button/button";
export default function ButtonGhost() {
return <Button variant="ghost">Ghost</Button>;
}
import { Settings } from "lucide-react";
import { Button } from "@/components/ui/button/button";
export default function ButtonIcon() {
return (
<Button size="icon" variant="outline">
<Settings size={16} />
</Button>
);
}
import { Button } from "@/components/ui/button/button";
export default function ButtonDisabled() {
return <Button disabled>Disabled</Button>;
}
"use client";
import { Button, Spinner } from "@/components/ui/button/button";
import styles from "./button-loading.module.css";
export default function ButtonLoading() {
return (
<div className={styles.container}>
<Button disabled>
<Spinner />
Always Loading
</Button>
</div>
);
}
import { ArrowPointer, Button } from "@/components/ui/button/button";
export default function ButtonExternalLink() {
return (
<Button render={<a href="#" />} style={{ borderRadius: "30px" }} variant="outline">
View External
<ArrowPointer pointExternal />
</Button>
);
}
import { ArrowPointer, Button } from "@/components/ui/button/button";
export default function ButtonWithArrow() {
return (
<Button>
With Arrow
<ArrowPointer />
</Button>
);
}
Component props
Prop
Type
Default
Name
variantDescription
The visual style variant of the button
Type
"primary" | "secondary" | "destructive" | "ghost" | "icon" | "outline" | "link"Default
"primary"Name
sizeDescription
The size of the button
Type
"sm" | "md" | "lg"Default
"md"Name
renderDescription
Custom element to render the button as (e.g., Link, anchor tag). Enables polymorphic behavior.
Type
ReactElementDefault
-
Name
classNameDescription
Additional CSS classes to apply to the button
Type
stringDefault
-
Name
childrenDescription
The content to display inside the button
Type
ReactNodeDefault
-
Name
disabledDescription
Whether the button is disabled and non-interactive
Type
booleanDefault
falseName
onClickDescription
Function to call when the button is clicked
Type
functionDefault
-
Name
typeDescription
The type attribute of the button element
Type
"button" | "submit" | "reset"Default
"button"Component props
Prop
Type
Default
Name
pointLeftDescription
When true, the arrow points left instead of right
Type
booleanDefault
falseName
pointExternalDescription
When true, applies external link arrow styling (rotates on hover)
Type
booleanDefault
falseThe Spinner component takes no props. It renders an animated loading spinner.