After SDC in 2023 for UI Components and the Icon API in 2024, having an API to make Drupal understand and use style utilities is in continuity of making Drupal a design system native CMS.
In design systems, styles may have many names:
- styles
- utilities
- helpers
- fundamentals
Most of the time, a style is a CSS class to apply to any element but it can be applied with other ways.
There are multiple contrib modules allowing to declare and apply classes, for examples:
Some have chosen to declare styles with code, others in config. Some covers specific usage: Block only, Layout Builder only, etc. The ecosystem is fragmented and a lot of efforts are duplicated to cover the different usages.
This is the occasion for improvements for frontend developers, backend developers and site builders:
- frontend developers will be able to declare the styles they provide and document how to use it
- easier usage in Twig
- a style library to instantly see the styles available
- remove friction, why some styles are available with one contrib module and not with another one. And no more need to enter classes manually
- styles can have a lifecycle and be deprecated