Skip to main content

How to create nested vertical tabs in Drupal 9 config form?

Here's how you can create nested vertical or horizontal tabs in Drupal Form API:

  1. Define your configuration form using the Drupal Form API by creating a new form class that extends ConfigFormBase or FormBase.

  2. Add a vertical_tabs element to your form using the Drupal\Core\Render\Element\VerticalTabs class. This will create the top-level vertical tabs.

  3. Inside each top-level vertical tab, add another vertical_tabs element to create the nested vertical tabs.


How to increase productivity as a Drupal Developer

Drupal Development

These are few things I picked up and still learning on my Drupal development journey that made my life easier. I love the architecture of Drupal but do find sometimes the amount of code to write, effort and learning curve a bit tedious. But these are all solvable issues. And I have solved them (more or less). Here are some tips for the same.

Subscribe to PHP


Therefore logo
80 Atlantic Ave, Toronto, ON Canada
Call us: +1 4166405376

Let us know how we can help!