Form and render elements - 11.x - drupal

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\RenderElementBase (render elements) or \Drupal\Core\Render\Element\FormElementBase (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\RenderElementBase

\Drupal\Core\Render\Element\FormElementBase

File

core/lib/Drupal/Core/Render/theme.api.php, line 484

Element machine name Sort descending Type Class Namespace Summary
actions \Drupal\Core\Render\Attribute\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 \Drupal\Core\Render\Attribute\RenderElement BreakLockLink Drupal\Core\TempStore\Element Provides a link to break a tempstore lock.
button \Drupal\Core\Render\Attribute\FormElement Button Drupal\Core\Render\Element Provides an action button form element.
checkbox \Drupal\Core\Render\Attribute\FormElement Checkbox Drupal\Core\Render\Element Provides a form element for a single checkbox.
checkboxes \Drupal\Core\Render\Attribute\FormElement Checkboxes Drupal\Core\Render\Element Provides a form element for a set of checkboxes.
color \Drupal\Core\Render\Attribute\FormElement Color Drupal\Core\Render\Element Provides a form element for choosing a color.
component RenderElement ComponentElement Drupal\sdc\Element Provides a Single Directory Component render element.
component \Drupal\Core\Render\Attribute\RenderElement ComponentElement Drupal\Core\Render\Element Provides a Single-Directory Component render element.
container \Drupal\Core\Render\Attribute\RenderElement Container Drupal\Core\Render\Element Provides a render element that wraps child elements in a container.
contextual_links \Drupal\Core\Render\Attribute\RenderElement ContextualLinks Drupal\contextual\Element Provides a contextual_links element.
contextual_links_placeholder \Drupal\Core\Render\Attribute\RenderElement ContextualLinksPlaceholder Drupal\contextual\Element Provides a contextual_links_placeholder element.
date \Drupal\Core\Render\Attribute\FormElement Date Drupal\Core\Render\Element Provides a form element for date or time selection.
datelist \Drupal\Core\Render\Attribute\FormElement Datelist Drupal\Core\Datetime\Element Provides a datelist element.
datetime \Drupal\Core\Render\Attribute\FormElement Datetime Drupal\Core\Datetime\Element Provides a datetime element.
deprecated \Drupal\Core\Render\Attribute\RenderElement Deprecated Drupal\element_info_test\Element Provides deprecated render element for testing.
deprecated_extends_form \Drupal\Core\Render\Attribute\FormElement DeprecatedExtendsFormElement Drupal\element_info_test\Element Provides render element that extends deprecated FormElement for testing.
deprecated_extends_render \Drupal\Core\Render\Attribute\RenderElement DeprecatedExtendsRenderElement Drupal\element_info_test\Element Provides render element that extends deprecated RenderElement for testing.
details \Drupal\Core\Render\Attribute\RenderElement Details Drupal\element_info_test\Render\Element Provides a render element for a details element.
details \Drupal\Core\Render\Attribute\RenderElement Details Drupal\Core\Render\Element Provides a render element for a details element, similar to a fieldset.
dropbutton \Drupal\Core\Render\Attribute\RenderElement Dropbutton Drupal\Core\Render\Element Provides a render element for a set of links rendered as a drop-down button.
email \Drupal\Core\Render\Attribute\FormElement Email Drupal\Core\Render\Element Provides a form input element for entering an email address.
entity_autocomplete \Drupal\Core\Render\Attribute\FormElement EntityAutocomplete Drupal\Core\Entity\Element Provides an entity autocomplete form element.
fieldgroup \Drupal\Core\Render\Attribute\RenderElement Fieldgroup Drupal\Core\Render\Element Provides a render element for a group of form elements.
fieldset \Drupal\Core\Render\Attribute\RenderElement Fieldset Drupal\Core\Render\Element Provides a render element for a group of form elements.
field_ui_table \Drupal\Core\Render\Attribute\RenderElement FieldUiTable Drupal\field_ui\Element Provides a field_ui table element.
file \Drupal\Core\Render\Attribute\FormElement File Drupal\Core\Render\Element Provides a form element for uploading a file.
form \Drupal\Core\Render\Attribute\RenderElement Form Drupal\Core\Render\Element Provides a render element for a form.
generic \Drupal\Core\Render\Attribute\RenderElement Generic Drupal\Core\Render\Element Provides a generic, empty element.
hidden \Drupal\Core\Render\Attribute\FormElement Hidden Drupal\Core\Render\Element Provides a form element for an HTML 'hidden' input element.
html \Drupal\Core\Render\Attribute\RenderElement Html Drupal\Core\Render\Element Provides a render element for an entire HTML page: <html> plus its children.
html_tag \Drupal\Core\Render\Attribute\RenderElement HtmlTag Drupal\Core\Render\Element Provides a render element for any HTML tag, with properties and value.
icon \Drupal\Core\Render\Attribute\RenderElement Icon Drupal\Core\Render\Element Provides a render element to display an icon.
image_button \Drupal\Core\Render\Attribute\FormElement ImageButton Drupal\Core\Render\Element Provides a form element for a submit button with an image.
inline_template \Drupal\Core\Render\Attribute\RenderElement InlineTemplate Drupal\Core\Render\Element Provides a render element where the user supplies an in-line Twig template.
item \Drupal\Core\Render\Attribute\FormElement Item Drupal\Core\Render\Element Provides a display-only form element with an optional title and description.
label \Drupal\Core\Render\Attribute\RenderElement Label Drupal\Core\Render\Element Provides a render element for displaying the label for a form element.
language_configuration \Drupal\Core\Render\Attribute\FormElement LanguageConfiguration Drupal\language\Element Defines an element for language configuration for a single field.
language_select \Drupal\Core\Render\Attribute\FormElement LanguageSelect Drupal\Core\Render\Element Provides a form element for selecting a language.
layout_builder \Drupal\Core\Render\Attribute\RenderElement LayoutBuilder Drupal\layout_builder\Element Defines a render element for building the Layout Builder UI.
link \Drupal\Core\Render\Attribute\RenderElement Link Drupal\Core\Render\Element Provides a link render element.
machine_name \Drupal\Core\Render\Attribute\FormElement MachineName Drupal\Core\Render\Element Provides a machine name render element.
managed_file \Drupal\Core\Render\Attribute\FormElement ManagedFile Drupal\file\Element Provides an AJAX/progress aware widget for uploading and saving a file.
more_link \Drupal\Core\Render\Attribute\RenderElement MoreLink Drupal\Core\Render\Element Provides a link render element for a "more" link, like those used in blocks.
number \Drupal\Core\Render\Attribute\FormElement Number Drupal\Core\Render\Element Provides a form element for numeric input, with special numeric validation.
operations \Drupal\Core\Render\Attribute\RenderElement Operations Drupal\Core\Render\Element Provides a render element for a set of operations links.
page \Drupal\Core\Render\Attribute\RenderElement Page Drupal\Core\Render\Element Provides a render element for the content of an HTML page.
pager \Drupal\Core\Render\Attribute\RenderElement Pager Drupal\Core\Render\Element Provides a render element for a pager.
page_title \Drupal\Core\Render\Attribute\RenderElement PageTitle Drupal\Core\Render\Element Provides a render element for the title of an HTML page.
password \Drupal\Core\Render\Attribute\FormElement Password Drupal\Core\Render\Element Provides a form element for entering a password, with hidden text.

Other projects


Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.