Ship faster with goilerplate templUI Pro

Button

Interactive element that triggers actions when clicked.

Source Tailwind CSS

Installation

templui add button

Examples

Sizes

Primary

Secondary

Destructive

Outline

Ghost

Icon

With Icon

Loading

API Reference

Required parameter
Hover for description

Button

Interactive button component with multiple variants and states.

Name Type Default
ID

Unique identifier for the button element.

string
-
Class

Additional CSS classes to apply to the button.

string
-
Attributes

Additional HTML attributes to apply to the button element.

templ.Attributes
-
Variant

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

Variant
default
Size

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

Size
default
FullWidth

Whether the button should take full width of its container.

bool
false
Href

URL for link buttons. When provided, renders an anchor tag instead of 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
Axel Adrian