Button

Interactive element that triggers actions when clicked.

Source Tailwind CSS

Installation

templui add button

Examples

Size

Default

Outline

Secondary

Ghost

Destructive

Icon

With Icon

Rounded

Spinner

API Reference

Required parameter
Hover for description

Button

Interactive button component with multiple variants and sizes.

Name Type Default
Variant

Visual style. Options: 'default', 'destructive', 'outline', 'secondary', 'ghost', 'link'.

Variant
default
Size

Button size. Options: 'default', 'xs', 'sm', 'lg', 'icon', 'icon-xs', 'icon-sm', 'icon-lg'.

Size
default
FullWidth

Whether the button stretches to the full width of its container.

bool
false
Href

URL for link buttons. When set, renders an anchor instead of a button.

string
-
Target

Target attribute for link buttons (e.g. '_blank').

string
-
Disabled

Whether the button is disabled and non-interactive.

bool
false
Type

HTML button type. Options: 'button', 'submit', 'reset'.

Type
button
Form

Associates the button with a form by id.

string
-
ID

Optional HTML id for the element.

string
-
Class

Additional CSS classes to apply.

string
-
Attributes

Additional HTML attributes to apply.

templ.Attributes
-