Add a background gradient to any container element (layout, teaser, div, etc.) by adding the u-bolt-bg-gradient
utility class to it.
This is a container with the .u-bolt-bg-gradient
class and .t-bolt-navy
theme class.
This is a container with the .u-bolt-bg-gradient
class and .t-bolt-teal
theme class.
This is a container with the .u-bolt-bg-gradient
class and .t-bolt-yellow
theme class.
{% set layout_item %}
{% include '@bolt-layouts-layout/layout-item.twig' with {
content: '<p>This is a layout item with a gradient background.</p>',
} only %}
{% endset %}
{% include '@bolt-layouts-layout/layout.twig' with {
attributes: {
class: [
'u-bolt-bg-gradient',
'u-bolt-padding-medium',
't-bolt-navy',
],
},
content: layout_item,
} only %}
<bolt-layout class="u-bolt-bg-gradient u-bolt-padding-medium t-bolt-navy">
<bolt-layout-item>
This is a layout item with a gradient background.
</bolt-layout-item>
</bolt-layout>
You can optionally add a modifier class in the form u-bolt-bg-gradient--focus-[vertical]-[horizontal]
to change the gradient focal point.
{% include '@bolt-components-teaser/teaser.twig' with {
attributes: {
class: [
'u-bolt-bg-gradient',
'u-bolt-bg-gradient--focus-top-left',
'u-bolt-padding-large',
't-bolt-navy',
],
},
variant: 'card',
headline: {
text: 'Top Left Gradient Focal Point',
},
} only %}
<div class="u-bolt-bg-gradient u-bolt-bg-gradient--focus-top-left t-bolt-navy u-bolt-padding-large">
<h2>Top Left Gradient Focal Point</h2>
</div>
--m-bolt-bg-highlight
and --m-bolt-bg-lowlight
.
{% include '@bolt-components-teaser/teaser.twig' with {
attributes: {
style: '--m-bolt-bg-highlight: var(--bolt-color-teal); --m-bolt-bg-lowlight: var(--bolt-color-navy-dark)',
class: [
'u-bolt-bg-gradient',
'u-bolt-padding-xlarge',
't-bolt-navy-light',
],
},
variant: 'card',
headline: {
text: 'Custom Gradient Colors',
},
} only %}
<div class="u-bolt-bg-gradient t-bolt-navy-light u-bolt-padding-xlarge" style="--m-bolt-bg-highlight: var(--bolt-color-teal); --m-bolt-bg-lowlight: var(--bolt-color-navy-dark)">
<h2>Custom Gradient Colors</h2>
</div>