Label

Accessible form label component for input association.

The Label component provides accessible labels for form inputs with proper association and styling.

Installation

bash
shellui add label

Usage

Basic

<div class="w-full max-w-sm space-y-2">
  <Label>Email</Label>
  <Input Type="email" Placeholder="email@example.com" />
</div>

With Input Association

<div class="w-full max-w-sm space-y-2">
  <Label For="email">Email</Label>
  <Input Type="email" Placeholder="email@example.com" />
</div>

With Checkbox

<div class="flex items-center space-x-2">
  <Checkbox @bind-Checked="acceptTerms" />
  <Label>I accept the terms and conditions</Label>
</div>

@code {
    private bool acceptTerms = false;
}

With Switch

<div class="flex items-center space-x-2">
  <Switch @bind-Checked="notificationsEnabled" />
  <Label>Enable notifications</Label>
</div>

@code {
    private bool notificationsEnabled = false;
}

Required Field Indicator

<div class="w-full max-w-sm space-y-2">
  <Label>
    Email
    <span class="text-destructive">*</span>
  </Label>
  <Input Type="email" />
</div>

API Reference

Parameter Type Default Description
For string "" Associates label with an input via id
ChildContent RenderFragment null Label text content

Accessibility

  • Uses semantic <label> element
  • Associates with inputs via For / Id attributes
  • Screen reader compatible
  • Proper styling for disabled states

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.