Button

A button lets users perform an action or trigger an event using mouse, touch, or keyboard input. It's a key interactive element in most user interfaces.

Example

Tone
Size
Radius
Usage

Features

  • Styleable – Hover, press, and keyboard focus states are provided for easy styling. These states only apply when interacting with an appropriate input device, unlike CSS pseudo classes.
  • Accessible – Uses a native <button> element under the hood, with support for the Space and Enter keys.
  • Cross-browser – Mouse, touch, keyboard, and focus interactions are normalized to ensure consistency across browsers and devices.

Installation

Install following dependencies:

npm install react-aria-components tw-animate-css tailwindcss-react-aria-components class-variance-authority lucide-react clsx tailwind-merge motion

Add cn helper using clsx and twMerge for conditional class merging in Tailwind components.

lib/utils.ts

Copy and paste the following code into your project.

components/ui/core/button.tsx
npx @libravelui@latest add button

Anatomy

import { Button } from "@/components/ui/core/button";
<Button tone="default">Default</Button>
<Button tone="secondary">Secondary</Button>
<Button tone="outline">Outline</Button>
<Button tone="ghost">Ghost</Button>
<Button tone="link">Link</Button>
<Button tone="destructive">Destructive</Button>

Props

Loading types…