Button

This is a default button component.

Installation

1. Dependencies

npm install clsx tailwind-merge

2. Paste inside @/lib/utils.ts

import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: Parameters<typeof clsx>) {
  return twMerge(clsx(...inputs));
}

3. Copy Button Code

Loading...

Copy Button Code

Button Props

NameTypeRequiredDefaultDescription
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link"No"default"The variant of the button, which determines its style.
size"default" | "sm" | "lg" | "icon"No"default"The size of the button, which determines its dimensions.
childrenReact.ReactNodeYesundefinedThe content to be displayed inside the button.
classNamestringNo""Additional class names for custom styling.
onClick() => voidNoundefinedCallback function triggered when the button is clicked.
disabledbooleanNofalseDisables the button, preventing user interaction.
type"button" | "submit" | "reset"No"button"Specifies the type of the button.