Skip to Content
✨ Just dropped my UI Library — still cooking up some magic! Stay tuned & maybe… hire me  or sponsor me 😉 
DocumentationButton

Button

A versatile and accessible button component with multiple variants, sizes, and states. Ideal for primary actions, secondary options, and loading indicators in forms and interfaces.

Install Dependencies

npx
quickcode-ui add Button

Default Usage

Default Button

Variants

Outline Variant

Secondary Variant

Ghost Variant

Destructive Variant

Link Variant

Sizes and Loading

Small Size

Large Size

Loading State

Props

PropTypeDefaultDescription
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link""default"Visual style of the button, affecting background, border, and text colors.
size"default" | "sm" | "lg" | "md" | "icon""default"Controls padding, height, and overall size of the button.
isLoadingbooleanfalseShows a loading spinner and disables the button during asynchronous actions.
disabledbooleanfalseDisables the button and applies reduced opacity.
classNamestringundefinedAdditional CSS classes for custom styling overrides.
onClick() => voidundefinedOptional click handler function.
type"button" | "submit" | "reset""button"HTML button type for form submissions.
childrenReact.ReactNodeundefinedButton content, such as text or icons.

Features

  • Multiple Variants: Supports default (primary blue), destructive (red), outline, secondary, ghost, and link styles for diverse use cases.
  • Size Options: From compact ‘sm’ to prominent ‘lg’, including icon-only buttons.
  • Loading State: Built-in spinner with Lucide React icon and automatic disabling.
  • Accessibility: Semantic button element with proper disabled states and screen reader support.
  • Customizable: Accepts className for easy overrides, just like shadcn.
  • Dark Mode Support: Automatic theme adaptation with semantic Tailwind classes.
  • Responsive: Scales well across devices with flexible sizing.

This button is most useful in forms for submit actions, in navigation for CTAs, or in dashboards for interactive elements where quick, professional interactions are needed.

Last updated on