Live demo — this example is server-driven; run the showcase locally for the interactive version.

Form

The outer <form> wrapper plus the standard PF v6 form-group structure — label, control, helper text. Composes the other form components (text-input, form-select, checkbox, radio, text-area).

Examples

Basic

Vertical form groups — label + control.

Horizontal

pf-m-horizontal — labels beside controls.

Limit width

pf-m-limit-width caps the form width.

Invalid

Error styling on a control with an error helper.

Enter a valid email address.

Invalid with form alert

An inline danger alert tops the form alongside the field error.

danger alert: Fill out all required fields before continuing.

Age must be a number.

Validated

Validates as you type — the control and helper flip between success and error.

Enter your age.
Looks good.
Age must be a number.

Horizontal stacked no padding top

Stacked checkbox options with pf-m-no-padding-top on the label.

Horizontal stacked helper text on top

Helper text above the control.

Helper text shown above the control.

Form group with additional label info

__group-label-info next to the label.

Additional label info

Form sections

__section with __section-title headings.

Section 1
Section 2 (optional)

Grid form

Form groups on the PF grid — two columns from md.

Field groups

Expandable and plain __field-groups with header actions. PF\u2019s "Form state" section is a React state demo of the same markup.

Field group 1
Settings in this group are expandable.
Field group 2 (non-expandable)

With helper text

Static helper text under a control.

This is the name other users will see.

Action group

The canonical submit/cancel row: pf-v6-c-form__group pf-m-action wrapping pf-v6-c-form__actions.

Form state

One central state object backs every field; Submit validates against it and "Show form state" dumps the live values and errors.



  

Documentation

Form props

Parameters accepted by {#include components/forms/form ... /}. Model mode: pass form=<Form> built in Java instead — the Java tab on each example shows the builder. The Form model's Group entries generate the form-group / label / control structure; in param mode it is hand-rendered inside the content slot — matching PF React where FormGroup is its own component.

* required
Name Type Description
* id String DOM id on the <form>.
horizontal boolean Adds pf-m-horizontal — label column to the left of controls. PF React's isHorizontal.
slot content Qute block Form children — typically a series of pf-v6-c-form__group blocks wrapping label + control + helper-text triples.

Usage

One Form per logical action. Wrap inputs that submit together in a single <form> with an HTMX hx-post on a submit button. Don't nest forms.

Use novalidate. The runtime sets novalidate on the form element so the browser's native validation UI doesn't fight your server-driven validation. Render errors via the helper-text pattern.

Horizontal vs. vertical. Vertical works for input-heavy forms (signup, profile). Horizontal compresses vertical space — best for settings panes and read-mostly forms.