Form Layout
A neutral responsive grid for form-related content.
FormLayout arranges form-related content with a responsive CSS Grid. It does not manage labels, errors, field state, validation, parsing, or submission.
Import
Section titled “Import”import { FormLayout } from "@zentara-co/zenos-ui";Responsive columns
Section titled “Responsive columns”columns accepts the shared responsive value shape. Start with one column so controls remain usable on narrow screens, then add columns as space permits.
Row and column gaps
Section titled “Row and column gaps”gap sets both axes. Use rowGap and columnGap when vertical form rhythm should differ from spacing between columns. Axis-specific values override the corresponding part of gap.
This field spans both columns while FormLayout continues to own the grid.
Children can span tracks through application-specific className when the form needs a full-width field. FormLayout intentionally does not expose a field-item abstraction.
Semantic element
Section titled “Semantic element”FormLayout renders a div by default. Use as="form" when it owns native form submission, or as="fieldset" when it groups related controls inside another form.
Native props follow the selected element. A form accepts action, method, and onSubmit; a fieldset accepts disabled, name, and its native grouping semantics.
Alignment
Section titled “Alignment”Use align to position items within their grid tracks and justify to distribute the grid’s content. Both accept responsive values. Most forms should keep the defaults so fields stretch consistently; change alignment only when mixed-size controls require it.
API
| Prop | Type | Default | Description |
|---|---|---|---|
as | ElementType | div | Rendered semantic element, including form, fieldset, or div. |
columns | Responsive<1 | 2 | ... | 12> | 1 | Responsive grid column count. |
gap | Responsive<Spacing> | 4 | Shared row and column gap. |
rowGap / columnGap | Responsive<Spacing> | — | Axis-specific gap overrides. |
align | Responsive<start | center | end | stretch | baseline> | — | Item alignment within grid tracks. |
justify | Responsive<start | center | end | between | around | evenly> | — | Grid content distribution on the inline axis. |
native props | React.HTMLAttributes<HTMLElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Responsibility
Section titled “Responsibility”Compose FormLayout with Field for label, description, error, required, invalid, and disabled semantics. Inputs remain responsible for native control behavior. Form libraries such as React Hook Form or TanStack Form can provide state without changing the layout API.
Accessibility
Section titled “Accessibility”Responsive columns must preserve DOM order and a logical keyboard sequence. Avoid visual placement classes that make the reading order differ from the source. Use a real form only when the region submits data, and give each fieldset a concise legend. FormLayout forwards refs, native attributes, className, style, aria-*, and data-*.