Skip to main content
Take a look at the live Drupal demo site. 🚀
Webhaven

Main navigation

  • Home
  • Who it's for
    • For Experts
    • For Agencies
    • For Starters
  • ROI calculator
  • Docs
  • Get launch notified

Breadcrumb

  1. Home
  2. Webhaven documentation
  3. Theming
  4. Component structure

Documentation

  • Documentation
    • Welcome
  • Get started
    • What is Webhaven?
    • Install with DDEV
    • Install without DDEV
    • Webhaven commands
    • Deploying your site
  • Configuration
    • Drupal Canvas
    • Multilingual
    • Site settings
  • Theming
    • Introduction
    • Theme structure
    • Create a custom theme
    • Single Directory Components (SDC)
    • Component structure
    • An example component
  • Handy resources
    • Roadmap
    • What are Drupal recipes?
    • What is a Drupal site template?
    • What is Drupal Canvas?
    • Drupal Canvas vs Layout Builder vs Paragraphs
    • What is DDEV?
    • Useful DDEV commands
    • What is Drush?
    • Useful Drush commands

Component structure

Let's get to know the file structure of a Webhaven component.

Component file structure

A component in Webhaven can consist of multiple files. Some are required and others are optional.

Let's get to know each file so you have a deeper understanding on how components work.

/[my-component]
|
|- README.md
|- [my-component].twig
|- [my-component].component.yml
|- [my-component].scss
|- _[my-component].js

Component specific files

README.md Documents what the component does, its props, slots, and any usage notes.

[my-component].twig The markup template for your component. This file is included in Drupal's .html.twig templates to render the component.

[my-component].component.yml Defines the component configuration: its name, description, props, slots, and other metadata.

[my-component].scss The Sass file for your component. Running npm run watch or npm run build will compile it to CSS automatically.

_[my-component].js The JavaScript file for your component. Running npm run watch or npm run build will bundle and minify it automatically. The leading underscore is required, the output file will not have it.

Webhaven components

Webhaven comes with a lot of components out of the box. When you create your own custom theme they are automatically copied over.

Previous page Single Directory Components (SDC) Next page An example component

You've seen how it works. Now see what it's worth.

See how much time and money Webhaven saves on every Drupal project.
Calculate my savings
Webhaven
Ship your best Drupal work, faster.

Links

  • Who it's for
  • Get launch notified
  • Demo
  • Docs
  • Free tools
  • Blog
  • Get in touch

Follow on

  • Our Drupal profile
  • Our LinkedIn profile
  • Our X profile
© 2026 Webhaven.
All rights reserved.

Legal

  • Privacy policy
  • Terms of service
  • Accessibility
  • Login
Built with