Svelte Label - Bitblue

Accessible form labels with color variants for helper and error states

Accessible form labels with color variants for default, success, and error states.

Setup

<script lang="ts">
	import { Label } from '@cailabs/components.forms';
</script>

Default

<script lang="ts">
	import { Label, Input } from '@cailabs/components.forms';
</script>

<Label for="email" class="mb-2">Your email</Label>
<Input id="email" type="email" placeholder="name@bitblue.com" />

Colors

Theme colors: disabled, primary, secondary, green, emerald, red, blue, yellow, orange, gray (typical default), teal, cyan, sky, indigo, lime, amber, violet, purple, fuchsia, pink, rose.

<Label color="gray">Gray</Label>
<Label color="green">Success</Label>
<Label color="red">Error</Label>
<Label color="primary">Primary</Label>
<Label color="disabled">Disabled</Label>

Show prop

When show={false}, only children render (no <label> wrapper)—useful when nesting interactive content that already has a label.

<script lang="ts">
	import { Label, Input } from '@cailabs/components.forms';
</script>

<Label show={false}>
	<span class="mb-2 block text-sm font-medium">Custom wrapper</span>
	<Input placeholder="…" />
</Label>

Accessibility

  • Always associate labels with controls via for / id, or wrap the control.
  • Use color as reinforcement only; include text that states the status.
  • Prefer visible labels over placeholder-only fields.

Props

PropTypeDefaultDescription
childrenSnippetrequiredLabel content
colortheme color—Text color token
showbooleantrueRender <label> or only children
forstring—Associated control id
classClassValue—Extra classes
...restHTML label attrs—Other label attributes

© 2026 Bitblue is a registered trademark. All Rights Reserved.