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