Label

Hello, my name is Email. An accessible name for a form control.

Demo

Installation

Usage

<script setup lang="ts">
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
</script>

<template>
  <Label for="email">Email</Label>
  <Input id="email" type="email" />
</template>

Inside a Field, use FieldLabel instead: it finds the control on its own.

Double-clicking a Label doesn't select its text. Put the control first and give it the peer class, as a checkbox does, and the label dims when the control is disabled.

API Reference

class is also accepted and merged over the base classes.

Data attributes

data-slotAttributesDescription
label—The label.

Changelog

No changes yet.