You are here

Form and render elements in Drupal 9

Primary tabs

Introduction to form and render elements

Render elements are referenced in render arrays. Render arrays contain data to be rendered, along with meta-data and attributes that specify how to render the data into markup; see the Render API topic for an overview of render arrays and render elements. Form arrays are a subset of render arrays, representing HTML forms; form elements are a subset of render elements, representing HTML elements for forms. See the Form API topic for an overview of forms, form processing, and form arrays.

Each form and render element type corresponds to an element plugin class; each of them either extends \Drupal\Core\Render\Element\RenderElement (render elements) or \Drupal\Core\Render\Element\FormElement (form elements). Usage and properties are documented on the individual classes, and the two base classes list common properties shared by all render elements and the form element subset, respectively.

See also

Render API overview

Form generation

\Drupal\Core\Render\Element\RenderElement

\Drupal\Core\Render\Element\FormElement

Element machine namesort descending Type Class Namespace Description
actions RenderElement Actions Drupal\Core\Render\Element Provides a wrapper element to group one or more buttons in a form.
ajax RenderElement Ajax Drupal\Core\Render\Element Provides a render element for adding Ajax to a render element.
break_lock_link RenderElement BreakLockLink Drupal\Core\TempStore\Element Provides a link to break a tempstore lock.
button FormElement Button Drupal\Core\Render\Element Provides an action button form element.
checkbox FormElement Checkbox Drupal\Core\Render\Element Provides a form element for a single checkbox.
checkboxes FormElement Checkboxes Drupal\Core\Render\Element Provides a form element for a set of checkboxes.
color FormElement Color Drupal\Core\Render\Element Provides a form element for choosing a color.
container RenderElement Container Drupal\Core\Render\Element Provides a render element that wraps child elements in a container.
contextual_links RenderElement ContextualLinks Drupal\contextual\Element Provides a contextual_links element.
contextual_links_placeholder RenderElement ContextualLinksPlaceholder Drupal\contextual\Element Provides a contextual_links_placeholder element.
date FormElement Date Drupal\Core\Render\Element Provides a form element for date selection.
datelist FormElement Datelist Drupal\Core\Datetime\Element Provides a datelist element.
datetime FormElement Datetime Drupal\Core\Datetime\Element Provides a datetime element.
details RenderElement Details Drupal\Core\Render\Element Provides a render element for a details element, similar to a fieldset.
dropbutton RenderElement Dropbutton Drupal\Core\Render\Element Provides a render element for a set of links rendered as a drop-down button.
email FormElement Email Drupal\Core\Render\Element Provides a form input element for entering an email address.
entity_autocomplete FormElement EntityAutocomplete Drupal\Core\Entity\Element Provides an entity autocomplete form element.
field_ui_table RenderElement FieldUiTable Drupal\field_ui\Element Provides a field_ui table element.
fieldgroup RenderElement Fieldgroup Drupal\Core\Render\Element Provides a render element for a group of form elements.
fieldset RenderElement Fieldset Drupal\Core\Render\Element Provides a render element for a group of form elements.
file FormElement File Drupal\Core\Render\Element Provides a form element for uploading a file.
form RenderElement Form Drupal\Core\Render\Element Provides a render element for a form.
hidden FormElement Hidden Drupal\Core\Render\Element Provides a form element for an HTML 'hidden' input element.
html RenderElement Html Drupal\Core\Render\Element Provides a render element for an entire HTML page: <html> plus its children.
html_tag RenderElement HtmlTag Drupal\Core\Render\Element Provides a render element for any HTML tag, with properties and value.
image_button FormElement ImageButton Drupal\Core\Render\Element Provides a form element for a submit button with an image.
inline_template RenderElement InlineTemplate Drupal\Core\Render\Element Provides a render element where the user supplies an in-line Twig template.
item FormElement Item Drupal\Core\Render\Element Provides a display-only form element with an optional title and description.
label RenderElement Label Drupal\Core\Render\Element Provides a render element for displaying the label for a form element.
language_configuration FormElement LanguageConfiguration Drupal\language\Element Defines an element for language configuration for a single field.
language_select FormElement LanguageSelect Drupal\Core\Render\Element Provides a form element for selecting a language.
link RenderElement Link Drupal\Core\Render\Element Provides a link render element.
machine_name FormElement MachineName Drupal\Core\Render\Element Provides a machine name render element.
managed_file FormElement ManagedFile Drupal\file\Element Provides an AJAX/progress aware widget for uploading and saving a file.
more_link RenderElement MoreLink Drupal\Core\Render\Element Provides a link render element for a "more" link, like those used in blocks.
number FormElement Number Drupal\Core\Render\Element Provides a form element for numeric input, with special numeric validation.
operations RenderElement Operations Drupal\Core\Render\Element Provides a render element for a set of operations links.
page RenderElement Page Drupal\Core\Render\Element Provides a render element for the content of an HTML page.
page_title RenderElement PageTitle Drupal\Core\Render\Element Provides a render element for the title of an HTML page.
pager RenderElement Pager Drupal\Core\Render\Element Provides a render element for a pager.
password FormElement Password Drupal\Core\Render\Element Provides a form element for entering a password, with hidden text.
password_confirm FormElement PasswordConfirm Drupal\Core\Render\Element Provides a form element for double-input of passwords.
path FormElement PathElement Drupal\Core\Render\Element Provides a matched path render element.
processed_text RenderElement ProcessedText Drupal\filter\Element Provides a processed text render element.
radio FormElement Radio Drupal\Core\Render\Element Provides a form element for a single radio button.
radios FormElement Radios Drupal\Core\Render\Element Provides a form element for a set of radio buttons.
range FormElement Range Drupal\Core\Render\Element Provides a slider for input of a number within a specific range.
responsive_image RenderElement ResponsiveImage Drupal\responsive_image\Element Provides a responsive image element.
search FormElement Search Drupal\Core\Render\Element Provides an HTML5 input element with type of "search".
select FormElement Select Drupal\Core\Render\Element Provides a form element for a drop-down menu or scrolling selection box.

Pages

Other projects