FormGroup

Form groups collect related controls with fieldset semantics, optional context, and stack or inline layout.

Overview and decision boundary

Use FormGroup to group related fields or controls with a semantic title, optional description, optional message, and stack, inline, or responsive grid layout.

Do not add form submission, validation-library integration, or schema behavior to FormGroup.

Preview

Notifications

Choose which updates should be sent by email.

import { Field, FormGroup } from '@nerio-ui/ui';import { Checkbox } from '@nerio-ui/ui/client';<FormGroup layout="grid" title="Notifications" description="Choose which updates should be sent by email.">  <Field label="Product updates"><Checkbox aria-label="Product updates" /></Field>  <Field label="Security alerts"><Checkbox aria-label="Security alerts" defaultChecked /></Field></FormGroup>

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm dlx nerio add form-groupimport { Field, FormGroup } from '@nerio-ui/ui';import { Checkbox } from '@nerio-ui/ui/client';

Usage

import { Field, FormGroup } from '@nerio-ui/ui';import { Checkbox } from '@nerio-ui/ui/client';<FormGroup layout="grid" title="Notifications" description="Choose which updates should be sent by email.">  <Field label="Product updates"><Checkbox aria-label="Product updates" /></Field>  <Field label="Security alerts"><Checkbox aria-label="Security alerts" defaultChecked /></Field></FormGroup>

Variants

VariantPurpose
stackStack is part of the public component contract.
inlineInline is part of the public component contract.
gridGrid is part of the public component contract.
invalidInvalid is part of the public component contract.

Anatomy

SlotPurpose
rootServer-safe fieldset wrapper.
titleLegend text that names the group.
descriptionOptional supporting text connected by aria-describedby.
contentNative children composition for Field, Checkbox, Switch, or custom controls.
messageOptional group-level help or validation message.

States

StatePurpose
DefaultGroups related controls without owning validation logic.
InvalidExposes aria-invalid and uses alert semantics only for active invalid messages.

Motion

  • State changes should use shared motion tokens and preserve reduced-motion behavior.

Accessibility

  • Renders a fieldset and uses legend when title is supplied.
  • Associates description and message text through aria-describedby.
  • Invalid state is explicit through invalid or aria-invalid and does not own validation logic.
  • Validation messages use role="alert" only when invalid is true.
  • Does not force a single control pattern or add form submission behavior.

API

PropPurpose
title / description / messageOptional group text slots.
layoutstack, inline, or responsive grid.
invalidSets data-invalid, aria-invalid, and alert semantics for message.
classNameExtends the fieldset root.

Implementation contract

ContractValue
Registry itemform-group installs 5 source files into the configured components directory.
Base UINo interactive primitive required.
Registry dependenciesform-message
Package dependenciesclsx, react, tailwind-merge, tailwindcss

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use FormGroup to group related fields or controls with a semantic title, optional description, optional message, and stack, inline, or responsive grid layout.

Do / do not

Do

Use for related notification preferences, radio-like sections, and field clusters.

Do not

Do not add form submission, validation-library integration, or schema behavior to FormGroup.

Tokens

These are the primary customization points. Override semantic or component tokens instead of changing component source.

TokenPurpose
--n-form-group-gapPublic customization point for this component contract.
--n-form-group-inline-gapPublic customization point for this component contract.
--n-form-group-title-colorPublic customization point for this component contract.
--n-form-group-description-colorPublic customization point for this component contract.
--n-form-group-message-colorPublic customization point for this component contract.
--n-field-gapPublic customization point for this component contract.
--n-color-text-primaryPublic customization point for this component contract.
--n-color-text-tertiaryPublic customization point for this component contract.
--n-color-status-dangerPublic customization point for this component contract.