This module exposes Twig's `html_cva` function to Drupal templates, allowing developers to manage component variants using the Class Variance Authority (CVA) pattern. This is particularly helpful for building reusable components, especially when working with utility-first CSS frameworks like Tailwind CSS.
Exposes Twig's built-in html_cva function to Drupal templates, enabling Class Variance Authority (CVA) for managing component variants. Useful for building reusable components with Tailwind CSS and other utility-first frameworks. This helps manage component variants (size, color, style, etc.) in Twig templates using a CVA pattern, similar to shadcn/ui and other component libraries.
Usage Example
{% set button = html_cva(
base: 'button',
variants: {
variant: { primary: 'bg-blue', secondary: 'bg-gray' },
size: { sm: 'text-sm', md: 'text-base', lg: 'text-lg' }
}
) %}
<button class="{{ button.apply({variant: 'primary', size: 'md'}) }}">
Click me
</button>
Ask your assistant about CVA (Class Variance Authority)
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
10 tracked projects depend on this one
- Mercury Theme 5,000 sites
- Byte (theme) 2,643 sites
- Varbase Components 517 sites
- Care Sphere Theme 128 sites
- Everbright (theme) 76 sites
- Forma (theme) 68 sites
- Flexus 39 sites
- Hourglass 30 sites
- Goodwell 23 sites
- Nightingale (Theme) 1 sites
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.2 | Stable | 11 | Nov 3, 2026 | ||
| 1.0.1 | Stable | 11 | Sep 18, 2026 | ||
| 1.0.0 | Stable | 11 | Jan 21, 2026 | ||
| 1.0.0-beta1 | Pre-release | 11 | Nov 20, 2025 |