A block is a reusable widget that is placed inside regions (layout containers) of your theme. Blocks can be created, removed, rearranged, and configured in the Block layout administration page. Examples of blocks include the "Who’s online" listing, the main navigation menu, and the breadcrumb trail. The main page content is also a block. Each block has its own configuration settings, which allow you to select which pages of your site will display the block.
A module can provide a block using the Plugin API. When a module provides a block, it is listed on the Block layout administrative page and can be placed in a region by a site administrator. Many tools, like Views or menus, have the ability to generate new blocks based on configuration, which can then be placed into regions.
- Rearrange blocks in a theme by placing them in specific regions
- Customize the visibility of a block for certain pages or types of pages
- Provide a block in a module using the Plugin API
Blocks are stable in Drupal core.
Blocks in code
Blocks are created using the Plugin API. Any module developer wishing to implement a new block will need to understand how the Plugin API works.
DrupalCon Dublin 2016: Drupal 8 Blocks: Who Knew? (youtube.com)
- This presentation looks at all the new features of the block system in Drupal 8 and provides some tips on how to solve common problems with blocks.
Transitioning from Drupal 7 to Drupal 8: programmatically creating blocks (befused.com)
- Side-by-side comparison of Blocks API code samples from Drupal 7 and 8. Useful if you know how to do something with blocks in Drupal 7 and need to learn how to do the same thing in Drupal 8.