Button
Displays a button or a component that looks like a button.
Component button-demo
not found in registry.
Installation
pnpm dlx kodkafa@latest add button
Usage
import { Button } from "@/components/ui/button"
<Button variant="outline">Button</Button>
Link
You can use the buttonVariants
helper to create a link that looks like a button.
import { buttonVariants } from "@/components/ui/button"
<Link className={buttonVariants({ variant: "outline" })}>Click here</Link>
Alternatively, you can set the asChild
parameter and nest the link component.
<Button asChild>
<Link href="/login">Login</Link>
</Button>
Examples
Primary
Component button-demo
not found in registry.
Secondary
Component button-secondary
not found in registry.
Destructive
Component button-destructive
not found in registry.
Outline
Component button-outline
not found in registry.
Ghost
Component button-ghost
not found in registry.
Link
Component button-link
not found in registry.
Icon
Component button-icon
not found in registry.
With Icon
Component button-with-icon
not found in registry.
Loading
Component button-loading
not found in registry.
As Child
Component button-as-child
not found in registry.
Changelog
2024-10-16 Classes for icons
Added gap-2 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0
to the button to automatically style icon inside the button.
Add the following classes to the cva
call in your button.tsx
file.
const buttonVariants = cva(
"inline-flex ... gap-2 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0"
)