FormSection

Form sections for grouping related fields with labels and descriptions.

Installation

bash
npx @smicolon/cli add form-section

Run init once per project before adding components. See Installation.

Preview

Personal Information

Update your personal details.

With Error

Form Actions

Props

The table covers the props of FormSection, FormField and FormActions.

PropTypeDefaultDescription
titlestring—Section title.
descriptionstring—Text below the title or label.
dividerbooleantrueShows a divider at the bottom.
labelstring—Field label.
errorstring—Error message below the field.
requiredbooleanfalseMarks the field as required.
htmlForstring—Connects the label to its input.
align"left" | "right" | "center" | "between""right"Alignment of the actions.
stickybooleanfalseSticks the actions to the bottom.
classNamestring—Extra classes for the part.

Usage

tsx
import { FormSection, FormField, FormActions } from "@/components/blocks/form-section"

<FormSection title="Account" description="Update your account settings.">
  <FormField label="Email" required>
    <Input type="email" />
  </FormField>
</FormSection>

<FormActions>
  <Button variant="outline">Cancel</Button>
  <Button>Save</Button>
</FormActions>