Form
Lay out fields, sections and actions with consistent spacing.
import { Form } from "@sagui/ui";Loading demo
When to use
- Any page or dialog that collects several fields.
- Splitting a long form into titled sections, with paired fields side by side.
When not to use
- Use Stepper with one Form per step for long linear flows.
Installation
Install the package and import the styles once. The installation guide covers the Tailwind setup.
$ npm install @sagui/uiUsage
import { Form, FormSection, FormRow, FormActions, Input, Button } from "@sagui/ui";
<Form onSubmit={save}>
<FormSection title="Company">
<FormRow>
<Input label="Legal name" />
<Input label="Trading name" />
</FormRow>
</FormSection>
<FormActions>
<Button variant="secondary">Cancel</Button>
<Button type="submit">Save</Button>
</FormActions>
</Form>Accessibility
- FormSection is a
fieldsetwith its title as thelegend. - On phones, actions stack with the primary action on top and fill the width.