Skip to content
Kappa
Fieldset
@dicehub/kappav0.4.2

Fieldset

Groups related controls with native fieldset semantics, shared state, and precise vertical or horizontal layouts.

Delivery channelsChoose the updates that should reach your team.
<script setup>
import { Fieldset } from "@dicehub/kappa/components/fieldset";
</script>

<template>
  <Fieldset.Root id="delivery-channels">
    <Fieldset.Legend>Delivery channels</Fieldset.Legend>
    <label><input type="checkbox" checked /> Email digest</label>
    <label><input type="checkbox" /> Slack activity</label>
    <Fieldset.HelperText>Choose the updates that should reach your team.</Fieldset.HelperText>
  </Fieldset.Root>
</template>

Installation

Fieldset is part of the main Kappa package and uses the installed Ark UI Fieldset primitive.

Barrel

import { Fieldset } from "@dicehub/kappa";

Granular

import { Fieldset } from "@dicehub/kappa/components/fieldset";

Usage

Place one Legend first, then the related controls. Helper and error text describe the complete group.

Contact preferencesSelect every channel that works for you.
<Fieldset.Root id="contact-preferences">
  <Fieldset.Legend>Contact preferences</Fieldset.Legend>
  <label><input type="checkbox" name="email" /> Email</label>
  <label><input type="checkbox" name="phone" /> Phone</label>
  <Fieldset.HelperText>Select every channel that works for you.</Fieldset.HelperText>
</Fieldset.Root>

Composition

Typical part hierarchy
Fieldset.Root
├── Fieldset.Legend
├── related native controls
├── Fieldset.HelperText
└── Fieldset.ErrorText

Ark UI owns native fieldset and legend semantics, generated IDs, disabled propagation, and polite error messaging. Kappa adds the compound exports, shared styling, and the orientation layout layer.

<script setup>
import {
  FieldsetRoot,
  FieldsetLegend,
  FieldsetHelperText,
} from "@dicehub/kappa/components/fieldset";
</script>

<template>
  <FieldsetRoot>
    <FieldsetLegend>Simulation outputs</FieldsetLegend>
    <label><input type="checkbox" /> Residual plot</label>
    <FieldsetHelperText>Reports are generated after the run completes.</FieldsetHelperText>
  </FieldsetRoot>
</template>

Kappa keeps Fieldset standalone so Checkbox and Radio can compose it without owning the group state.

Examples

Orientation

Vertical stacks direct children. Horizontal uses responsive columns and keeps the legend and messages full width.

Vertical layout
Horizontal layout
<Fieldset.Root orientation="vertical">
  <Fieldset.Legend>Vertical layout</Fieldset.Legend>
  <label><input type="radio" name="vertical" /> Steady state</label>
  <label><input type="radio" name="vertical" /> Transient</label>
</Fieldset.Root>

<Fieldset.Root orientation="horizontal">
  <Fieldset.Legend>Horizontal layout</Fieldset.Legend>
  <label><input type="radio" name="horizontal" /> Local</label>
  <label><input type="radio" name="horizontal" /> Cluster</label>
</Fieldset.Root>

Validation and Disabled

Invalid renders ErrorText and references it from the group. Native disabled fieldsets disable their descendant controls.

Required channelsChoose at least one channel.
Locked channelsAvailable to workspace administrators.
<Fieldset.Root id="required-channels" invalid>
  <Fieldset.Legend>Required channels</Fieldset.Legend>
  <label><input type="checkbox" /> Audit log</label>
  <Fieldset.ErrorText>Choose at least one channel.</Fieldset.ErrorText>
</Fieldset.Root>

<Fieldset.Root id="locked-channels" disabled>
  <Fieldset.Legend>Locked channels</Fieldset.Legend>
  <label><input type="checkbox" checked /> System alerts</label>
  <Fieldset.HelperText>Available to workspace administrators.</Fieldset.HelperText>
</Fieldset.Root>

Accessibility

  • Use one visible Legend to name each group. Do not use a fieldset as a generic layout wrapper.
  • Keep related controls inside the native fieldset so disabled propagation and group announcement work.
  • HelperText and ErrorText receive generated IDs and are connected to the fieldset by aria-describedby.
  • Use invalid with a corrective ErrorText message. ErrorText is a polite live region.
  • Use disabled when every descendant control is unavailable; native browser behavior remains authoritative.

API Reference

Fieldset.Root

PropTypeDefaultDescription
orientation"vertical" | "horizontal""vertical"Stacks direct children or flows them into responsive columns.
disabledbooleanfalseDisables the native fieldset and its form controls.
invalidbooleanfalseMarks the group invalid and enables its ErrorText part.
idstringgeneratedSets the seed used for generated legend, helper, and error part IDs.
asChildbooleanfalseMerges Ark UI root behavior and attributes into one child element.

Parts

PartPropTypeDescription
Legend / HelperText / ErrorTextasChildbooleanMerges the part attributes into one child element.

Composition Parts

PartDescription
Fieldset.RootNative fieldset that owns group state, IDs, and layout.
Fieldset.RootProviderRenders a fieldset from a useFieldset machine.
Fieldset.LegendNative legend that names the control group.
Fieldset.HelperTextPersistent guidance referenced by the fieldset.
Fieldset.ErrorTextInvalid-state message with polite live semantics.
Fieldset.ContextExposes the current Ark fieldset context to a scoped slot.

Exports

ExportDescription
FieldsetCompound Fieldset component and Root alias.
FieldsetRootNamed native fieldset root.
FieldsetRootProviderRoot that consumes an external fieldset machine.
FieldsetLegendNamed native legend part.
FieldsetHelperTextNamed helper text part.
FieldsetErrorTextNamed invalid-state text part.
FieldsetContextScoped fieldset context slot.
useFieldsetCreates an Ark fieldset machine for RootProvider.
useFieldsetContextReads the closest fieldset context.
fieldsetAnatomyArk UI fieldset anatomy metadata.
FIELDSET_ORIENTATIONSSupported Kappa layout values.
resolveFieldsetOrientationSafe runtime layout resolver.