Widget

Drupal uses the word widget for the input control of one field on an edit form, set on Manage form display. Pieces placed in page regions are blocks.

Learn DrupalDrupal glossary

In Drupal, a widget is a field widget: the form control that an editor uses to enter the data of a field. The Drupal User Guide defines it as the method used to enter the data for the field. Core widgets include a text box, a select list, a checkbox and an autocomplete.

What the word means in Drupal 11

Widgets belong to the editing side of a field. You choose one per field and per form mode, and you can set its options, hide it or reorder it. The same data can be entered in different ways. The user guide's example is a taxonomy term field, which can use an autocomplete field, a select list or a tags-style field. In core, a widget is a plugin that builds Form API elements and adds processing for field values. The page on field widgets covers the plugin details.

Other words are easy to confuse with it:

TermWhat it isWhere you set it
WidgetThe input control for a field on an edit formManage form display
Field formatterThe output of a field when the entity is displayedManage display
BlockA piece of page layout in a theme regionBlock layout

Example

A Recipe content type has an Ingredients field that points to taxonomy terms. On the edit form, an editor sees one input for each ingredient. Under Structure › Content types, open the menu beside Recipe and choose Manage form display. After you select Autocomplete (Tags style) as the widget for Ingredients and save, the editor types several ingredients into a single text field. It is still the same field; only the way editors enter its values changed.

Common mistakes

  • Looking for widgets on the Block layout page. That page places blocks in regions. A widget lives on an edit form.
  • Expecting a widget to change the public page. Output belongs to the formatter, which is a separate setting.
  • Choosing a widget to fix a data problem. A widget changes how editors enter a value. If the field holds the wrong kind of data, the field type is the problem.

For marketing and content teams

When an editing form feels slow or awkward, the widget can be the setting to change. A site builder switches it on Manage form display. Describe the pain in plain words ("I want to type all tags in one line") and the site builder can pick a matching widget.

With DXPR

If you came looking for the pieces you drop onto a page, those are blocks in Drupal. In DXPR Builder, the pieces you place are elements; an empty builder field starts with an Add Elements button. See DXPR Builder.

Sources

Questions about Widget

No. A widget is the input control for one field on an edit form. A block is an individual piece of page layout that you place in a theme region on the Block layout page. Drupal uses the word block for the second one.

Core ships widgets such as Textfield, Single on/off checkbox, Select list, Number field and Autocomplete (Tags style). Contributed modules can add more. Which ones you can pick for a field depends on the field type.

On the Manage form display page of the content type, found under Structure › Content types. Select the widget in the Widget column for the field and click Save.

Related terms

All Drupal terms from A to Z