GitHub Stars

Button

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

Installation

npx shadcn@latest add @fulldev/button

Usage

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

You can also import buttonVariants to reuse button styles on custom elements.

import { buttonVariants } from "@/components/ui/button"
<Button>Button</Button>

Pass href to render the button as a link element. You can also pass as="a" explicitly when you want to make the rendered element obvious at the call site.

---
import { Button } from "@/components/ui/button"
---

<Button href="#">Login</Button>

Polymorphic

Button is polymorphic via as. Pass as to change the rendered element and use the relevant attributes for that element.

<Button as="button" type="button">Save</Button>
<Button href="/docs/">Docs</Button>
<Button as="label" for="file-upload">Upload</Button>

Examples

With Icon

The spacing between the icon and the text is automatically adjusted based on the size of the button. You do not need any margin on the icon.

Rounded

Use the rounded-full class to make the button rounded.

API Reference

See the GitHub source code for more information on props.