Design guidelines: Form and form control - #5047
Conversation
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.
- 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)
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.
|  | ||
| </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. |
andrew-ronaldson
left a comment
There was a problem hiding this comment.
Looks good to me but waiting on feedback about the react props.
mcoker
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Is the padding off in the react component or off in the design guidelines image? I have no 4.5px top padding in figma. Trying to figure out which is correct? @mcoker @andrew-ronaldson
There was a problem hiding this comment.
Oh sorry that top padding is present in the react component but not in the screenshot in this PR (from figma, I'm guessing?)
There was a problem hiding this comment.
Sorry, I think I asked my question wrong! I know that the react has the top padding but i wasnt sure if the top padding is supposed to be there in general? Wondering if the figma implementation with no top padding is correct or if the top padding in the react component is the correct implementation and I need to update the figma component to match? @mcoker
There was a problem hiding this comment.
Oh you asked correctly, I misread 😅 AFAIK the spacing hasn't changed, it's been like that for as far back as I remember. It's to better align the label with a text input/menu toggle (when the label is next to a box that has a border, top padding, and text in it). We have a variant for form labels that removes the top padding when the label is used with checkboxes or elements where the padding doesn't make as much sense - https://www.patternfly.org/components/forms/form#horizontal-stacked-no-padding-top
That said, the padding looked a lot better in PF5 - the label text was better aligned with the input text beside it.
Does make me wonder if we should update that either to remove the padding like in figma, or update the label padding so it centers better with the text in form inputs beside the label like it did in PF5. Forms are everywhere so it would have a fairly big impact if we changed it.
There was a problem hiding this comment.
Ahh okay thanks for the background context! @andrew-ronaldson @lboehling thoughts?
There was a problem hiding this comment.
@mcoker we can make a design issue to look at the alignment again. I'm okay merging this with that follow up in mind
…/checkbox/checkbox.md Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
…/checkbox/checkbox.md Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>
…/form/forms.md Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>
…/form-control/form-control.md Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
…/form-control/form-control.md Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
…/form-control/form-control.md Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
…/checkbox/checkbox.md Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
…/checkbox/checkbox.md Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
…/checkbox/checkbox.md Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
…/checkbox/checkbox.md Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
- Delete unreferenced PNG duplicates from checkbox, form-control, form, radio, and text-input img folders - Update general spacing token to --pf-t--global--spacer--gap--group-to-group--vertical--default - Update button spacing token to --pf-t--global--spacer--gap--action-to-action--default - Add xl spacer reference for form-to-button-group spacing - Rename section to "Menu toggles in a form" and update pf-m-form description to mention isForm prop
andrew-ronaldson
left a comment
There was a problem hiding this comment.
Will make a design follow up to look at the label inconsistencies from Figma and react
|
Your changes have been released in:
Thanks for your contribution! 🎉 |

closes #5052
Changes
pf-m-formmodifierpf-m-formusage note to the form-control design guidelines--pf-t--global--spacer--lg,--pf-t--global--spacer--md)