Skip to content
Glint UI

Label

The caption for a control, which moves focus to it when clicked and marks it required.

Usage

import { Label, LabelVariant } from "@glint/components/label.slint";
import { Input } from "@glint/components/input.slint";
export component AppWindow inherits Window {
VerticalLayout {
alignment: center;
Label {
text: "Full Name";
variant: LabelVariant.required;
clicked => { name-input.focus(); }
}
name-input := Input {
placeholder: "Enter full name";
}
}
}

Label renders an accessible form caption. Wire clicked to focus the associated input or control.

Examples

Label variants

variant configures the caption styling:

  • LabelVariant.default: Primary foreground text.
  • LabelVariant.muted: Secondary muted color for optional fields or subtle descriptions.
  • LabelVariant.required: Appends a destructive red asterisk (*) to the caption.

Slotted badges and indicators

The @children slot places badges, icons, or hint chips beside the label caption.

Disabled state

Setting disabled: true dims the label and disables click-to-focus triggers.

API Reference

Properties

PropertyTypeDefaultDescription
textin stringno defaultThe label text.
variantin LabelVariantLabelVariant.defaultVisual style — default, muted, required (appends an asterisk).
disabledin boolfalseFollows the control into its disabled state: the caption dims, the click-to-focus association goes quiet, and assistive technology hears that there is nothing to hand the keyboard to. Field sets this for the label it owns, so a disabled form row says it once.

Callbacks

CallbackDescription
clicked()Fired when the label is clicked; useful for forwarding focus.

Enums

EnumValues
LabelVariantdefault, muted, required

Accessibility

  • Text role. Publishes accessible-role: text with accessible-label: root.text.
  • Action default. The accessible default action fires clicked(), enabling assistive technology to focus the associated input in the same manner as a pointer click.
  • Decorative asterisk. The required indicator is marked accessible-role: none so screen readers do not redundantly read decorative punctuation.