2.24.0
Background Component in Bolt
Background can be added to any container. Part of the Bolt “Components” CSS framework that powers the Bolt Design System.
npm install @bolt/components-background
Background allows Bolt to set an image inside of bands.
We recommend a max-width of 2880px
for full-bleed background images. This recommendation takes into consideration the common HD screen resolution of 1920x1080
and multiplies 1920
by 1.5
.
{% include "@bolt-components-background/background.twig" with {
opacity: "heavy",
fill: "gradient",
focalPoint: {
vertical: "center",
horizontal: "center"
},
contentItems: [
{
pattern: "image",
src: "/images/content/backgrounds/background-tall-4.jpg"
}
]
} only %}
Note: when assigning component props as HTML attributes on a web component, make sure to use kebab-case
.
Prop Name | Description | Type | Default Value | Option(s) |
---|---|---|---|---|
attributes | A Drupal-style attributes object with extra attributes to append to this component. |
object
| — |
|
opacity | Overlay opacity |
string
|
medium
|
|
overlay | Should an overlay be used for this background. |
string
|
enabled
|
|
shapeGroup | Add a Bolt Background Shapes group. |
string
|
none
|
|
shapeAlignment | Alignment of shape group. |
string
|
right
|
|
fill | Type of fill to use for the overlay. |
string
|
color
|
|
fillColor | Color of the fill to use in the overlay. |
string
|
default
|
|
focalPoint | Where the opacity background should originate. |
object
| — |
|
contentItems | An array of objects to place in the background. Works with Image and Shape components. Video option is deprecated. |
array
| — |
|
Heavy Opacity with Left Focal Point
Heavy Opacity with Right Focal Point
Background Shapes: Shape Group A
Background Shapes: Shape Group B
Background Shapes: Shape Group A, Alignment Left
Note: valign
is an Image component prop, not a Background component prop. Set valign
on images passed in via contentItems
to control the vertical alignment.
valign: center
valign: top
valign: bottom
valign: 25%