<div class="variant theme-default">
Some Text<br><br>
<em>current theme: default</em>
</div>
<style>
.variant {
--bg-color: #000;
--color: #fff;
}
.variant.theme-red {
--bg-color: #DA2315;
--color: #fff;
}
.variant.theme-gray {
--bg-color: #848484;
--color: #fff;
}
.variant {
background-color: var(--bg-color);
color: var(--color);
padding: 30px;
line-height: 1.4;
}
</style>
<div class="variant theme-{{ theme }}">
{{ text }}<br><br>
<em>current theme: {{ theme }}</em>
</div>
<style>
.variant {
--bg-color: #000;
--color: #fff;
}
.variant.theme-red {
--bg-color: #DA2315;
--color: #fff;
}
.variant.theme-gray {
--bg-color: #848484;
--color: #fff;
}
.variant {
background-color: var(--bg-color);
color: var(--color);
padding: 30px;
line-height: 1.4;
}
</style>
Variants allow you to create different context for the same component.
variants
array in the components respective [component].config.js
[component]--variant-name.twig
accordion--alt.twig
- The Accordion component with a variant called “Alt”This option should be used when the underlying markup does not change. Example scenarious would be:
video
variant vs the image
variant in a page header
This option should only be used when underlying markup will change significantly. Example scenarious would be:
See examples/variants/variants.config.js