Button

Documentation Index

Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.

A button or a component that looks like a button.

button-demo

Overview

Use a button for actions. A button should do something on the current page, submit a form, open a menu, start a task, or confirm a choice.

Use a link when the user is navigating to another page. If a link must look like a button, render the link through the button component so the visual style is shared while the semantics stay correct.

Anatomy

A button has a visible label, optional icon, variant, size, and state. The label should describe the action directly. Prefer Save changes, Invite member, or Delete project over vague labels like Submit or Continue when the result is specific.

Variants

Use the default variant for primary actions, secondary for supporting actions, outline for medium emphasis, ghost for low emphasis, link for inline actions, and destructive for dangerous actions.

Accessibility

Buttons must have accessible names. Icon-only buttons need a label through text, aria-label, or an equivalent pattern. Keep disabled and loading states clear so users understand why the action is unavailable.

Installation

npx honestui@latest add button

Usage

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

You can use the render prop to make another component look like a button. Here's an example of a link that looks like a button.

import Link from "next/link"

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

export function LinkAsButton() {
  return <Button render={<Link href="/login" />}>Login</Button>
}

Examples

Our examples cover variants, sizes, icon layouts, disabled state, link rendering, and loading behavior.

Default

button-default

Outline

button-outline

Secondary

button-secondary

Destructive

button-destructive

Destructive Outline

button-destructive-outline

Ghost

button-ghost
button-link

Extra-small Size

button-xs

Small Size

button-sm

Large Size

button-lg

Extra-large Size

button-xl

Disabled

button-disabled

Icon

button-icon

Icon Small Size

button-icon-sm

Icon Large Size

button-icon-lg

With Icon

button-with-icon
button-with-link

Loading

button-loading