Label

Renders an accessible label associated with controls.

Source Tailwind CSS JavaScript

Get notified about new features and updates.

Installation

templui add label

Load the script once in your layout:

<head>
  @label.Script()
</head>

Usage

The Label component enhances the following form controls:

API Reference

Required parameter
Hover for description

Label

Accessible label component for associating text with form controls.

Name Type Default
ID

Unique identifier for the label element.

string
-
Class

Additional CSS classes to apply to the label.

string
-
Attributes

Additional HTML attributes to apply to the label element.

templ.Attributes
-
For

ID of the form control this label is associated with (for attribute).

string
-
Error

Error message that changes the label styling to indicate validation errors.

string
-