<arc-fieldset> Overview
Guidelines
When to use
- Group related inputs that share a common label — e.g., "Shipping Address" fields
- Use the card variant for visually distinct form sections in settings pages
- Use the error prop for group-level validation like "Select at least one option"
- Provide a legend for every fieldset — it is the accessible group label
When not to use
- Nest fieldsets more than one level deep — it creates confusing screen reader announcements
- Use Fieldset for visual-only grouping — use a `div` or `arc-card` instead
- Put field-level errors in the fieldset error slot — attach those to individual inputs
Features
- Native `<fieldset>` and `<legend>` elements for proper form semantics
- Two variants: default (bordered) and card (elevated surface)
- Legend text via prop or slot for flexible heading content
- Description text for group-level helper context
- Error message with `role="alert"` for group validation feedback
- Actions slot for inline legend controls (Select all, Reset, etc.)
- Disabled state cascades to all child controls via native fieldset behavior
- Exposed CSS parts: fieldset, legend, description, content, error
Preview
Usage
<arc-fieldset legend="Contact info" description="We'll use this to reach you.">
<arc-label for="email" required>Email</arc-label>
<arc-input id="email" type="email" placeholder="you@example.com"></arc-input>
<arc-label for="phone">Phone</arc-label>
<arc-input id="phone" type="tel" placeholder="(555) 123-4567"></arc-input>
</arc-fieldset>
<!-- Card variant with error -->
<arc-fieldset legend="Preferences" variant="card" error="Please select at least one option.">
<arc-checkbox label="Option A"></arc-checkbox>
<arc-checkbox label="Option B"></arc-checkbox>
</arc-fieldset> import { Fieldset, Label, Input, Checkbox } from '@arclux/arc-ui-react';
<Fieldset legend="Contact info" description="We'll use this to reach you.">
<Label htmlFor="email" required>Email</Label>
<Input id="email" type="email" placeholder="you@example.com" />
<Label htmlFor="phone">Phone</Label>
<Input id="phone" type="tel" placeholder="(555) 123-4567" />
</Fieldset> <script setup>
import { Fieldset, Label, Input } from '@arclux/arc-ui-vue';
</script>
<template>
<Fieldset legend="Contact info" description="We'll use this to reach you.">
<Label for="email" required>Email</Label>
<Input id="email" type="email" placeholder="you@example.com" />
</Fieldset>
</template> <script>
import { Fieldset, Label, Input } from '@arclux/arc-ui-svelte';
</script>
<Fieldset legend="Contact info" description="We'll use this to reach you.">
<Label for="email" required>Email</Label>
<Input id="email" type="email" placeholder="you@example.com" />
</Fieldset> import { Component } from '@angular/core';
import { Fieldset, Label, Input } from '@arclux/arc-ui-angular';
@Component({
imports: [Fieldset, Label, Input],
template: `
<Fieldset legend="Contact info" description="We'll use this to reach you.">
<Label for="email" required>Email</Label>
<Input id="email" type="email" placeholder="you@example.com" />
</Fieldset>
`,
})
export class ContactForm {} import { Fieldset, Label, Input } from '@arclux/arc-ui-solid';
<Fieldset legend="Contact info" description="We'll use this to reach you.">
<Label for="email" required>Email</Label>
<Input id="email" type="email" placeholder="you@example.com" />
</Fieldset> import { Fieldset, Label, Input } from '@arclux/arc-ui-preact';
<Fieldset legend="Contact info" description="We'll use this to reach you.">
<Label for="email" required>Email</Label>
<Input id="email" type="email" placeholder="you@example.com" />
</Fieldset> <!-- Use native <fieldset> and <legend> -->
<fieldset class="arc-fieldset" style="border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 16px 24px 24px;">
<legend style="font-weight: 600; color: var(--text-primary); padding: 0 4px;">Contact info</legend>
<p style="font-size: 14px; color: var(--text-muted);">We'll use this to reach you.</p>
<!-- inputs here -->
</fieldset> <fieldset style="border: 1px solid rgb(42, 42, 52); border-radius: 10px; padding: 16px 24px 24px; margin: 0;">
<legend style="font-weight: 600; color: rgb(224, 224, 232); padding: 0 4px;">Contact info</legend>
<!-- inputs here -->
</fieldset> API
| Prop | Type | Default | Description |
|---|---|---|---|
legend | string | '' | Text displayed in the `<legend>` element. Also available via the `legend` slot for rich content. |
description | string | '' | Helper text displayed below the legend. |
disabled | boolean | false | Disables all child controls and dims the fieldset. |
error | string | '' | Error message displayed below the content with `role="alert"`. |
variant | 'default' | 'card' | 'default' | Visual style. Card adds a surface background and shadow. |
See Also
- Label Form label with required indicator, optional description text, and tooltip slot. Pairs with any input component via the `for` attribute.
- Form Form wrapper with built-in validation, error aggregation, and submit handling. Composes Input, Textarea, and Button into a cohesive data-entry workflow.
- Switch Group Groups multiple toggle switches under a shared label with consistent sizing and disabled state. Supports vertical and horizontal layouts.