Skip to content

Align form to architecture goals#188

Open
lifeiscontent wants to merge 2 commits into
mainfrom
align/form
Open

Align form to architecture goals#188
lifeiscontent wants to merge 2 commits into
mainfrom
align/form

Conversation

@lifeiscontent

Copy link
Copy Markdown
Collaborator

Closes #130

What the designer spec says

From @bhaveshraja's comment on #130:

Always the same — vertical field stacking, consistent gap between fields, uniform vertical rhythm, error state behavior, required-field indicator style.

Depends (adjustable) — fields and their arrangement, layout (single column vs multi-column), submit button label/variant, secondary actions, validation behavior, inline vs sectioned layout.

Changes

layout variant added to formVariants (variants.ts)

The "layout" axis (single vs multi-column) is now a required CVA variant with two values:

  • "single"flex-col, fields stack vertically (the spec's "always the same" vertical rhythm)
  • "multi"flex-row flex-wrap, suitable for side-by-side field pairs

No defaultVariants — callers must be explicit, per the architecture rule.

FormProps extended with required layout (form.tsx)

layout is extracted and forwarded to formVariants({ layout }). The className/style omit is unchanged.

Story fixes (ui/form.stories.tsx)

The UI-tier stories wrapped children in <div className="flex w-80 flex-col gap-4"> — this made the Form's own flex layout a no-op since fields weren't direct children. The wrapper now only carries w-80 (as a meta decorator for demo width), and fields are direct <Form> children. layout="single" added to story args.

Components-tier story updated (components/form.stories.tsx)

ExampleForm passes layout="single" to <Form> and story objects supply it in args to satisfy the required type.

Notes

  • Needs design approval from @bhaveshraja before merging.
  • Visuals are equivalent to before for layout="single" (same flex flex-col gap-4).

@github-actions

Copy link
Copy Markdown

📚 Storybook preview: https://pr-188-propel-storybook.vamsi-906.workers.dev

Add a required `layout` variant ("single" | "multi") to the Form
component, reflecting the designer's spec (issue #130): vertical
field stacking is always the same, but layout axis is adjustable.
Removes the redundant flex/col/gap wrapper div from UI-tier stories
so children are direct Form descendants and the component's own
vertical rhythm is what governs spacing.
The form had its field-stacking and bottom-actions layout conflated on
the single Form root, with the layout axis baked there. Split them into
two single-element anatomy parts so each region owns its own chrome:

- FormBody — the field stack. Carries the adjustable single/multi-column
  `layout` variant (issue #130's "depends" axis); uniform field gap is
  baked.
- FormActions — the bottom actions bar. Position is always the same; the
  `variant` axis selects right-aligned (`inline`) vs full-width
  (`stretch`) per the spec.

Form root now only governs the vertical rhythm between regions. Both
stories compose the new parts and register them as subcomponents.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Form: what should always look the same, and what should be adjustable?

1 participant