Skip to content

Label

A styled form label associated with a control via for, with an optional required marker.

<script>
import Label from "@invisible-ui/svelte/Label.svelte";
</script>
PropTypeDefaultDescription
requiredbooleanfalseShow a * required marker.

The label text is the default slot.

<Label for="email" required>Email</Label>
<input id="email" type="email" />

In React, htmlFor names the control, and useLabel gives the same props to a label of your own:

<Label htmlFor="email" required>
Email
</Label>
<input id="email" type="email" />

Themeable via --ds-label-*.