Skip to content

Label

The Label component provides accessible labels for form inputs with optional required indicator.

Preview

Import

import { Label } from 'meridian';

Props

PropTypeDefaultDescription
requiredbooleanWhether the associated field is required

Usage

Basic

<Label htmlFor="my-input">Field name</Label>
<Input id="my-input" />

Required Fields

Use the required prop to show a required indicator:

<Label htmlFor="required-field" required>Email address</Label>
<Input id="required-field" type="email" />
Required Indicator

With Checkbox

<div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
<Checkbox id="terms" />
<Label htmlFor="terms">Accept terms and conditions</Label>
</div>
With Checkbox

With Switch

<div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
<Switch id="notifications" />
<Label htmlFor="notifications">Enable notifications</Label>
</div>
With Switch