Package org.patternfly.component.form
package org.patternfly.component.form
Provides form components for building structured data entry interfaces.
This package contains the Form component and its sub-components for
creating accessible, validated forms. Forms organize input controls into groups with labels, helper text, and
validation feedback. The package includes text inputs, text areas, form selects, checkboxes, and radio buttons.
Components
Checkbox- Checkbox controlCheckboxBody- Body content area of a checkboxCheckboxDescription- Description text for a checkboxForm- Top-level form containerFormActionGroup- Contains form action buttons (submit, cancel)FormAlert- Displays an alert within a formFormControl- Base class for form controls with validation supportFormFieldGroup- Nestable field group with header and bodyFormFieldGroupBody- Body area of a form field groupFormFieldGroupHeader- Header area of a form field group with title and actionsFormGroup- Groups a label with a control and helper textFormGroupControl- Control area within a form groupFormGroupLabel- Label for a form groupFormGroupRole- Enumeration of form group ARIA roles (radiogroup, group)FormSection- Groups related form groups under a headingFormSelect- Native select dropdownFormSelectOption- Individual option within a form selectFormSelectOptionGroup- Option group within a form selectRadio- Radio button controlRadioBody- Body content area of a radio buttonRadioDescription- Description text for a radio buttonTextArea- Multi-line text inputTextAreaResize- Enumeration of text area resize optionsTextInput- Single-line text inputTextInputType- Enumeration of text input types (text, email, password, etc.)
Usage
A basic form with text inputs, checkboxes, and action buttons:
import static org.patternfly.component.button.Button.button;
import static org.patternfly.component.form.Checkbox.checkbox;
import static org.patternfly.component.form.Form.form;
import static org.patternfly.component.form.FormActionGroup.formActionGroup;
import static org.patternfly.component.form.FormGroup.formGroup;
import static org.patternfly.component.form.FormGroupControl.formGroupControl;
import static org.patternfly.component.form.FormGroupLabel.formGroupLabel;
import static org.patternfly.component.form.FormGroupRole.radiogroup;
import static org.patternfly.component.form.Radio.radio;
import static org.patternfly.component.form.TextInput.textInput;
import static org.patternfly.component.form.TextInputType.email;
import static org.patternfly.component.help.HelperText.helperText;
Form form = form()
.addGroup(formGroup("name").required()
.addLabel(formGroupLabel("Full name"))
.addControl(formGroupControl()
.addControl(textInput("name"))
.addHelperText(helperText("Include your middle name if you have one."))))
.addGroup(formGroup("email").required()
.addLabel(formGroupLabel("Email"))
.addControl(formGroupControl()
.addControl(textInput(email, "email"))))
.addGroup(formGroup("timezone").role(radiogroup)
.addLabel(formGroupLabel("Timezone"))
.addControl(formGroupControl().inline()
.addRadio(radio("tz-0", "timezone", "Eastern"))
.addRadio(radio("tz-1", "timezone", "Central"))
.addRadio(radio("tz-2", "timezone", "Pacific"))))
.addActionGroup(formActionGroup()
.addButton(button("Submit").primary())
.addButton(button("Cancel").link()));
- See Also:
-
ClassDescriptionA checkbox is used to select a single item or multiple items, typically to choose elements to perform an action or to reflect a binary setting.A body content of a checkbox within a
Checkboxcomponent.A description text of a checkbox within aCheckboxcomponent.A form is a group of elements used to collect information from a user in a variety of contexts, including in a modal, in a wizard, or on a page.A form action group within aFormcomponent.A form alert within aFormcomponent.A wrapper for form control elements such as inputs, selects, and text areas within aForm.A form field group within aFormcomponent.A body of a form field group within aFormFieldGroupcomponent.A header of a form field group within aFormFieldGroupcomponent.A form group within aFormcomponent.The control area within aFormGroup, containing the actual input element.A label within a form group within aFormGroupcomponent.Defines the ARIA role applied to aFormGroup.A form section within aFormcomponent.A form select embeds browser native select lists into a form.A form select option within aFormSelectcomponent.A option group within a form select within aFormSelectcomponent.A radio button is used to present the user with mutually exclusive choices.A body content of a radio button within aRadiocomponent.A description text of a radio button within aRadiocomponent.A text area component is used for entering a paragraph of text that is longer than one line.Defines the resize directions available for aTextArea.A text input is used to gather free-form text from a user.Defines the HTML input types available for aTextInput.