Skip to content
Drivn logoDrivn

Button

Displays a button or a component that looks like a button.

Preview

Installation

npx drivn add button

Usage

1import { Button } from "@/components/ui/button"
2
3export default function Page() {
4 return (
5 <Button variant="default">
6 Click me
7 </Button>
8 )
9}
Drivn Feature

Slots

Use leftIcon and rightIcon props for clean icon placement.

Left IconleftIcon

Place an icon before the button text for actions like "Add", "Back", etc.

Right IconrightIcon

Place an icon after the button text for actions like "Next", "External link", etc.

Loading State

Show a loading indicator and disable interaction with the loading prop.

Loadingloading

Shows a spinner and disables interaction when loading is true.

Disabled State

Reduce opacity and prevent interaction with the disabled prop.

Disableddisabled

Reduces opacity and prevents all interaction when disabled is true.

API Reference

PropTypeDefaultDescription
variant"default" | "secondary" | "outline" | "destructive""default"Visual style of the button
size"sm" | "md" | "lg""md"Size of the button
rounded"md" | "full""full"Border radius of the button
loadingbooleanfalseShows spinner and disables interaction
disabledbooleanfalseDisables the button
leftIconComponentType | ReactElementIcon component (Plus) or element (<Plus className="..." />)
rightIconComponentType | ReactElementIcon component (Plus) or element (<Plus className="..." />)