> For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/llms-full.txt.

# FormSection

Data Entry`@rockshin/tao-ui`

[Examples](#examples)[API](#api)

Groups related form fields with a title and optional description.

## When to use

Use FormSection to break long forms into scannable groups.

**Recommended**

- Use headings that describe the group, not the control type.
- Keep each section focused on one user decision area.

**Avoid**

- Do not use the component outside its intended interaction model.

## Examples


### Basic usage
```tsx preview
import { FormField, FormSection, Input } from '@rockshin/tao-ui';

function FormSectionExample() {
  return (
    <FormSection title="Profile" description="Information shown to teammates.">
      <FormField label="Display name">
        <Input placeholder="Rihua Chen" />
      </FormField>
      <FormField label="Role">
        <Input placeholder="Product engineer" />
      </FormField>
    </FormSection>
  );
}

export default FormSectionExample;
```

### Multiple field groups
```tsx preview
import { FormField, FormSection, Input, Stack } from '@rockshin/tao-ui';

function FormSectionGroups() {
  return (
    <Stack gap="lg">
      <FormSection title="Identity" description="How teammates recognize you.">
        <FormField label="Display name">
          <Input placeholder="Rihua Chen" />
        </FormField>
      </FormSection>
      <FormSection
        title="Contact"
        description="Where account notices are sent."
      >
        <FormField label="Email">
          <Input placeholder="you@example.com" />
        </FormField>
      </FormSection>
    </Stack>
  );
}

export default FormSectionGroups;
```

### Semantic parts
```tsx preview
import { FormSection } from '@rockshin/tao-ui';

function CustomizedFormSection() {
  return (
    <FormSection
      title="Advanced"
      description="Settings for experienced users."
      styles={{
        root: { maxWidth: 520 },
        title: { fontWeight: 600 },
        body: { paddingTop: 12 },
      }}
    >
      Advanced configuration belongs here.
    </FormSection>
  );
}

export default CustomizedFormSection;
```

### Complete form composition
Compose layout, fields, and actions with native submission feedback.
```tsx preview
import { useState } from 'react';
import {
  FormLayout,
  FormSection,
  FormField,
  FormActions,
  Input,
  Textarea,
  Button,
} from '@rockshin/tao-ui';
export default function Example() {
  const [saved, setSaved] = useState('');
  return (
    <form
      onSubmit={(e) => {
        e.preventDefault();
        setSaved(String(new FormData(e.currentTarget).get('name')));
      }}
      onReset={() => setSaved('')}
    >
      <FormLayout>
        <FormSection title="Profile" description="Public workspace information">
          <FormField label="Display name" required>
            <Input name="name" required defaultValue="Alex" />
          </FormField>
          <FormField label="Bio" description="A short introduction">
            <Textarea name="bio" autoSize />
          </FormField>
        </FormSection>
        <FormActions>
          <Button type="reset">Reset</Button>
          <Button type="submit" variant="primary">
            Save
          </Button>
        </FormActions>
        <output aria-live="polite">
          {saved ? `Saved ${saved}` : 'No changes saved'}
        </output>
      </FormLayout>
    </form>
  );
}
```

### Optional descriptions
A title can stand alone; add description when extra context helps.
```tsx preview
import { FormSection, FormLayout, Input } from '@rockshin/tao-ui';
export default function Example() {
  return (
    <FormLayout>
      <FormSection title="Contact">
        <Input aria-label="Contact address" />
      </FormSection>
      <FormSection
        title="Internal notes"
        description="Visible to workspace members only"
      >
        <Input aria-label="Internal notes" />
      </FormSection>
    </FormLayout>
  );
}
```

### Section styling
Use header and body semantic parts to style a section.
```tsx preview
import { FormSection, FormField, Input } from '@rockshin/tao-ui';
export default function Example() {
  return (
    <FormSection
      title="Billing"
      styles={{
        root: {
          border: '1px solid var(--tao-color-border)',
          borderRadius: 6,
          padding: 16,
        },
        body: { paddingTop: 8 },
      }}
    >
      <FormField label="Company">
        <Input />
      </FormField>
    </FormSection>
  );
}
```

## API


### [#](#formsection)FormSection



| Property | Description | Type | Default Value |
| --- | --- | --- | --- |
| className | Additional css class | `string | undefined` | `-` |
| style | Additional style | `CSSProperties | undefined` | `-` |

