Skip to Content
Patternfly Logo

Form

A form is a group of elements used to collect information from a user. Related design guidelines: Forms

ExamplesPropsCSS Variables

Examples

Basic

Please provide your full name

Horizontal

Please provide your full name

Invalid

Age has to be a number

Validated

Enter your age to continue

Horizontal no padding top

Props

ActionGroup properties
NameTypeRequiredDefaultDescription
childrenReact.ReactNodeNonullAnything that can be rendered as ActionGroup content.
classNamestringNo''Additional classes added to the ActionGroup.
Form properties
NameTypeRequiredDefaultDescription
childrenReact.ReactNodeNonullAnything that can be rendered as Form content.
classNamestringNo''Additional classes added to the Form.
isHorizontalbooleanNofalseSets the Form to horizontal.
FormGroup properties
NameTypeRequiredDefaultDescription
childrenReact.ReactNodeNonullAnything that can be rendered as FormGroup content.
classNamestringNo''Additional classes added to the FormGroup.
labelReact.ReactNodeNoLabel text before the field.
isRequiredbooleanNofalseSets the FormGroup required.
validated'success' | 'error' | 'default'No'default'Sets the FormGroup validated. If you set to success, text color of helper text will be modified to indicate valid state. If set to error, text color of helper text will be modified to indicate error state.
isInlinebooleanNofalseSets the FormGroup isInline.
hasNoPaddingTopbooleanNofalseRemoves top spacer from label.
helperTextReact.ReactNodeNoHelper text after the field. It can be a simple text or an object.
helperTextInvalidReact.ReactNodeNoHelper text after the field when the field is invalid. It can be a simple text or an object.
fieldIdstringYesID of the included field. It has to be the same for proper working.
FormHelperText properties
NameTypeRequiredDefaultDescription
childrenReact.ReactNodeNonullContent rendered inside the Helper Text Item
isErrorbooleanNofalseAdds error styling to the Helper Text *
isHiddenbooleanNotrueHides the helper text *
classNamestringNo''Additional classes added to the Helper Text Item

CSS Variables

.pf-c-form--pf-c-form--GridGap
1.5rem
.pf-c-form--pf-c-form__group--m-action--MarginTop
2rem
.pf-c-form--pf-c-form--m-horizontal__group-label--md--GridColumnWidth
9.375rem
.pf-c-form--pf-c-form--m-horizontal__group-label--md--GridColumnGap
1rem
.pf-c-form--pf-c-form--m-horizontal__group-control--md--GridColumnWidth
1fr
.pf-c-form--pf-c-form--m-horizontal__group-label--md--PaddingTop
0.5rem
.pf-c-form--pf-c-form__group-label--PaddingBottom
0.5rem
.pf-c-form--pf-c-form__label--FontSize
0.875rem
.pf-c-form--pf-c-form__label--LineHeight
1.3
.pf-c-form--pf-c-form__label--m-disabled--Color
#6a6e73
.pf-c-form--pf-c-form__label-text--FontWeight
600
.pf-c-form--pf-c-form__label-required--MarginLeft
0.25rem
.pf-c-form--pf-c-form__label-required--FontSize
0.875rem
.pf-c-form--pf-c-form__label-required--Color
#c9190b
.pf-c-form--pf-c-form__group-label-help--PaddingTop
0.25rem
.pf-c-form--pf-c-form__group-label-help--PaddingRight
0.25rem
.pf-c-form--pf-c-form__group-label-help--PaddingBottom
0.25rem
.pf-c-form--pf-c-form__group-label-help--PaddingLeft
0.25rem
.pf-c-form--pf-c-form__group-label-help--MarginTop
calc(0.25rem * -1)
.pf-c-form--pf-c-form__group-label-help--MarginRight
calc(0.25rem * -1)
.pf-c-form--pf-c-form__group-label-help--MarginBottom
calc(0.25rem * -1)
.pf-c-form--pf-c-form__group-label-help--MarginLeft
calc(0.25rem * -1 + 0.25rem)
.pf-c-form--pf-c-form__group-label-help--FontSize
0.875rem
.pf-c-form--pf-c-form__group-label-help--TranslateY
0.125rem
.pf-c-form--pf-c-form__group-control--m-inline--child--MarginRight
1.5rem
.pf-c-form--pf-c-form__actions--child--MarginTop
0.5rem
.pf-c-form--pf-c-form__actions--child--MarginRight
0.5rem
.pf-c-form--pf-c-form__actions--child--MarginBottom
0.5rem
.pf-c-form--pf-c-form__actions--child--MarginLeft
0.5rem
.pf-c-form--pf-c-form__actions--MarginTop
calc(0.5rem * -1)
.pf-c-form--pf-c-form__actions--MarginRight
calc(0.5rem * -1)
.pf-c-form--pf-c-form__actions--MarginBottom
calc(0.5rem * -1)
.pf-c-form--pf-c-form__actions--MarginLeft
calc(0.5rem * -1)
.pf-c-form--pf-c-form__helper-text--MarginTop
0.25rem
.pf-c-form--pf-c-form__helper-text--FontSize
0.875rem
.pf-c-form--pf-c-form__helper-text--Color
#151515
.pf-c-form--pf-c-form__helper-text-icon--FontSize
1rem
.pf-c-form--pf-c-form__helper-text-icon--MarginRight
0.25rem
.pf-c-form--pf-c-form__helper-text--m-error--Color
#c9190b
.pf-c-form--pf-c-form__helper-text--m-success--Color
#0f280d
.pf-c-form.pf-m-horizontal--pf-c-form__group-label--PaddingBottom
0
.pf-c-form__helper-text.pf-m-error--pf-c-form__helper-text--Color
#c9190b
.pf-c-form__helper-text.pf-m-success--pf-c-form__helper-text--Color
#0f280d