Skip to content

Design guidelines: Form and form control #5047

Open
kaylachumley wants to merge 9 commits into
mainfrom
form-guidelines
Open

Design guidelines: Form and form control #5047
kaylachumley wants to merge 9 commits into
mainfrom
form-guidelines

Conversation

@kaylachumley

@kaylachumley kaylachumley commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

closes #5052

Changes

  • Added a Best practices section to the form design guidelines with a "Menu toggles and dropdowns in a form" subsection documenting the pf-m-form modifier
  • Added pf-m-form usage note to the form-control design guidelines
  • Updated spacing references in the form design guidelines to use design tokens (--pf-t--global--spacer--lg, --pf-t--global--spacer--md)
  • Replaced design guidelines images for the form, form-control, checkbox, radio, and text-input components

Adds a new "Best practices" section with a "Menu toggles and dropdowns in a form" subsection, documenting the use of the pf-m-form modifier and its effect on border radius across themes. Includes a do/don't example image.
@kaylachumley kaylachumley changed the title Updat to Form and form control guidelines Updat to Form and form control design guidelines Jun 30, 2026
@patternfly-build

patternfly-build commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Preview: https://pf-org--pr-5047-site.surge.sh

@kaylachumley kaylachumley changed the title Updat to Form and form control design guidelines Update to Form and form control design guidelines Jul 9, 2026
@kaylachumley kaylachumley changed the title Update to Form and form control design guidelines Design guidelines: Form and form control Jul 9, 2026
Comment thread packages/documentation-site/patternfly-docs/content/components/form/forms.md Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 9, 2026

Copy link
Copy Markdown

Deploying patternfly-org with  Cloudflare Pages  Cloudflare Pages

Latest commit: c22ca21
Status:🚫  Build failed.

View logs

- Replace design guidelines images for form, form-control, checkbox, radio, and text-input
- Update spacing references in form design guidelines to use token values (--pf-t--global--spacer--lg, --pf-t--global--spacer--md)

@kaylachumley kaylachumley left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updates all of the forms and form related design guidelines images

Swaps PNG placeholders for actual SVG files across form, form-control,
checkbox, radio, and text-input design guidelines to fix blurry images.
Updates markdown references to match new SVG filenames.
## Usage
While form controls are useful in providing feedback on user input, they don't need to be implemented for every input instance. Only use form controls when it is essential to convey information to the user. For example, if any string is valid for a text input, or any selection in a list is acceptable, form controls are not necessary.

Apply the `pf-m-form` modifier to all dropdowns and menu toggles used in a form. The `.pf-m-form` class modifies the menu toggle's border radius to match other form elements. Read more on form controls in the [Form guidelines](/components/forms/form/design-guidelines).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolethoen @kmcfaul @mcoker this makes sense to me but do we need to mention props on the react components or is the CSS enough?

![Do and don't example showing a menu toggle with the pf-m-form modifier applied (square corners) versus without it (pill shape) in a form context.](./img/form-toggle-modifier.svg)
</div>

In the default PatternFly theme, form elements use `--pf-t--global--border--radius--control--form-element` (6px) border radius token. In the [Felt theme](/foundations-and-styles/theming#project-felt-theme), form elements, including input fields, menu toggles, and dropdowns, continue to use the same `--pf-t--global--border--radius--control--form-element` (6px) token, while other non-control components use `--pf-t--global--border--radius--control--default`. Using the `pf-m-form` class ensures that your form elements and menu toggle always match the border radius of the surrounding form fields, regardless of theme.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this update @kaylachumley

@andrew-ronaldson andrew-ronaldson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me but waiting on feedback about the react props.

@mcoker
mcoker requested a review from thatblindgeye July 16, 2026 18:15

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments, some are pretty nitpicky so feel free to pick and choose what you think is worth updating. Nothing here is blocking.

One thing though - it looks like this PR is adding a .png file for most/all of the SVGs - was that intended to be checked in? The images on the site are all still using the .svg - none of the markdown docs pages were updated to reference the new .png files.


<div class="ws-docs-content-img">
![Example 1 of do's and don'ts for using a checkbox or a switch.](./img/CB-vs-switch-1.svg)
![Example 1 of do's and don'ts for using a checkbox or a switch.](./img/checkbox-vs-switch-1.svg)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you remove the "Save changes" button from the one with switches?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alignment is a little off. There is a 4.5px top padding in the component

Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no big deal but the form on the right has "Button" text for both buttons, and has more space than the form on the left. I would expect the link button text to be "Cancel" since that's what all of our examples use.

![Example of a group of checkboxes.](./img/checkbox-alignment.svg)
</div>

You also have the option to use progressive disclosure by nesting other controls underneath a checkbox. The nested options would be enabled or disabled when the user selects or deselects a checkbox.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the form docs for progressive disclosure, we use the language "hide and show", which I think is more clear than enabled/disabled since enable/disable has special meaning when it comes to form fields.

Suggested change
You also have the option to use progressive disclosure by nesting other controls underneath a checkbox. The nested options would be enabled or disabled when the user selects or deselects a checkbox.
You also have the option to use progressive disclosure by nesting other controls underneath a checkbox. The nested options would be shown or hidden when the user selects or deselects a checkbox.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the exclamation-circle in the right one is kinda floating in the middle of the input

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field group toggle/text is off-center compared to the examples

Image


### General spacing
Always add 24px of spacing underneath each form input. If a form input includes helper text, this 24px spacing should start below the helper text. Spacing between data inputs like checkboxes and radio buttons should also be 24px when on the same line or stacked on one another. For more spacing information, consult the [PatternFly spacer guidelines](/foundations-and-styles/spacers#considering-line-height-and-padding).
Add `--pf-t--global--spacer--lg` (24px) of spacing below each form input. If a form input includes helper text, this spacing should start below the helper text. Spacing between data inputs like checkboxes and radio buttons should also be `--pf-t--global--spacer--lg` (24px) when on the same line or stacked on one another. For more spacing information, see the [PatternFly spacer guidelines](/foundations-and-styles/spacers#considering-line-height-and-padding).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW we use --pf-t--global--spacer--gap--group-to-group--vertical--default between form groups.

IMO the image is a little weird, too

  • It shows padding around the form, which probably shouldn't be there (it isn't part of our form)
  • It calls out the xl/32px spacer between the last form group and the submit button row but that isn't in this paragraph
    • Also the image refers to that spacer as "2xl" when the code uses "xl"
  • If we do use the more semantic spacer (gap--group-to-group...) in the docs, I wonder if we should update the image, too.

### Button spacing

Place submit or cancel buttons on the bottom left of a form, left-aligned with all form fields. Buttons should be placed 16px apart in all contexts. Buttons for actions other than submitting or canceling the form may be placed elsewhere within a form depending on your use case.
Place submit or cancel buttons on the bottom left of a form, left-aligned with all form fields. Buttons should be spaced using `--pf-t--global--spacer--md` (16px) in all contexts. Buttons for actions other than submitting or canceling the form may be placed elsewhere within a form depending on your use case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW we use --pf-t--global--spacer--gap--action-to-action--default in the code (in our action list component).


To ensure your forms are consistent, maintainable, and adaptable across different themes, we recommend following these best practices.

### Menu toggles and dropdowns in a form

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is clear for designers, I'm sure it's good, but to me the word "dropdowns" reads like it's something separate from a menu toggle. I would probably just say menu toggles.

![Do and don't example showing a menu toggle with the pf-m-form modifier applied (square corners) versus without it (pill shape) in a form context.](./img/form-toggle-modifier.svg)
</div>

In the default PatternFly theme, form elements use `--pf-t--global--border--radius--control--form-element` (6px) border radius token. In the [Felt theme](/foundations-and-styles/theming#project-felt-theme), form elements, including input fields, menu toggles, and dropdowns, continue to use the same `--pf-t--global--border--radius--control--form-element` (6px) token, while other non-control components use `--pf-t--global--border--radius--control--default`. Using the `pf-m-form` class ensures that your form elements and menu toggle always match the border radius of the surrounding form fields, regardless of theme.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, but above you used the period conditionally to refer to the "pf-m-form modifier" and ".pf-m-form class", but here you're referring to the class so I would use the period.

Suggested change
In the default PatternFly theme, form elements use `--pf-t--global--border--radius--control--form-element` (6px) border radius token. In the [Felt theme](/foundations-and-styles/theming#project-felt-theme), form elements, including input fields, menu toggles, and dropdowns, continue to use the same `--pf-t--global--border--radius--control--form-element` (6px) token, while other non-control components use `--pf-t--global--border--radius--control--default`. Using the `pf-m-form` class ensures that your form elements and menu toggle always match the border radius of the surrounding form fields, regardless of theme.
In the default PatternFly theme, form elements use `--pf-t--global--border--radius--control--form-element` (6px) border radius token. In the [Felt theme](/foundations-and-styles/theming#project-felt-theme), form elements, including input fields, menu toggles, and dropdowns, continue to use the same `--pf-t--global--border--radius--control--form-element` (6px) token, while other non-control components use `--pf-t--global--border--radius--control--default`. Using the `.pf-m-form` class ensures that your form elements and menu toggles always match the border radius of the surrounding form fields, regardless of theme.

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.

Add Design Guidelines for Form Control Elements (Square vs Pilled)

4 participants