Ship faster with goilerplate templUI Pro

Checkbox

Control that allows selecting multiple options from a list.

Source Tailwind CSS JavaScript

Get notified about new features and updates.

Installation

templui add checkbox

Load the script once in your layout:

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

Examples

Form

Choose all areas that interest you.

Please select at least one interest.

Indeterminate

API Reference

Required parameter
Hover for description

Checkbox

Control that allows selecting multiple options from a list.

Name Type Default
ID

Unique identifier for the checkbox element.

string
-
Class

Additional CSS classes to apply to the checkbox.

string
-
Attributes

Additional HTML attributes to apply to the checkbox element.

templ.Attributes
-
Name

Name attribute for the form input.

string
-
Value

Value attribute for the checkbox input.

string
-
Disabled

Whether the checkbox is disabled and non-interactive.

bool
false
Checked

Whether the checkbox is initially checked.

bool
false
Group

Group name to link checkboxes together. When set, checkboxes with the same group name will be connected for parent-child behavior.

string
-
GroupParent

Marks this checkbox as the parent of its group. The parent checkbox automatically toggles all children and shows an indeterminate state when some children are checked.

bool
false
Icon

Custom icon component to use instead of the default checkmark.

templ.Component
-