File size: 4,466 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
---
title: Background
description:
JSX style props for styling background colors, gradients, and images.
---
## Background Attachment
Use `bgAttachment` to control the attachment of a background image.
```jsx
<Box bgAttachment="fixed" bgImage="url(...)" />
```
| Prop | CSS Property | Token Category |
| -------------------------------------- | ----------------------- | -------------- |
| `bgAttachment`, `backgroundAttachment` | `background-attachment` | - |
## Background Blend Mode
Use `bgBlendMode` prop to control how an element's background image should blend
with the its background color.
```jsx
<Box bgBlendMode="multiply" bgColor="red.200" bgImage="url(...)" />
```
## Background Clip
Use `bgClip` to control the clipping of a background image.
```jsx
<Box bgClip="border-box" bgImage="url(...)" />
```
| Prop | CSS Property | Token Category |
| -------------------------- | ----------------- | -------------- |
| `bgClip`, `backgroundClip` | `background-clip` | - |
## Background Color
Use `bg`, `bgColor`, or `backgroundColor` props to set the background color of
an element.
```jsx
<Box bg="red.200" />
<Box bgColor="red.200" />
// with opacity modifier
<Box bg="blue.200/30" />
<Box bgColor="blue.200/30" />
```
| Prop | CSS Property | Token Category |
| ---------------------------- | ------------------ | -------------- |
| `bg`, `background` | `background` | `colors` |
| `bgColor`, `backgroundColor` | `background-color` | `colors` |
## Background Origin
Use `bgOrigin` or `backgroundOrigin` to control the origin of a background
image.
```jsx
<Box bgOrigin="border-box" bgImage="url(...)" />
```
| Prop | CSS Property | Token Category |
| ------------------------------ | ------------------- | -------------- |
| `bgOrigin`, `backgroundOrigin` | `background-origin` | - |
## Background Position
Properties for controlling the src and position of a background image.
```jsx
<Box bgImage="url(...)" bgPosition="center" />
```
| Prop | CSS Property | Token Category |
| ------------------------------------ | ------------------ | -------------- |
| `bgPosition`, `backgroundPosition` | `background-image` | - |
| `bgPositionX`, `backgroundPositionX` | `background-image` | - |
| `bgPositionY`, `backgroundPositionY` | `background-image` | - |
## Background Repeat
Use `bgRepeat` or `backgroundRepeat` to control the repeat of a background
image.
```jsx
<Box bgRepeat="no-repeat" bgImage="url(...)" />
```
| Prop | CSS Property | Token Category |
| ------------------------------ | ------------------- | -------------- |
| `bgRepeat`, `backgroundRepeat` | `background-repeat` | - |
## Background Size
Use `bgSize` or `backgroundSize` to control the size of a background image.
```jsx
<Box bgSize="cover" bgImage="url(...)" />
```
| Prop | CSS Property | Token Category |
| -------------------------- | ----------------- | -------------- |
| `bgSize`, `backgroundSize` | `background-size` | - |
## Background Image
Use `bgImage` or `backgroundImage` to set the background image of an element.
```jsx
<Box bgImage="url(...)" />
<Box bgImage="radial-gradient(circle, #0000 45%, #000f 48%)" />
<Box bgImage="linear-gradient(black, white)" />
// with token reference
<Box bgImage="linear-gradient({colors.red.200}, {colors.blue.200})" />
```
| Prop | CSS Property | Token Category |
| ---------------------------- | ------------------ | --------------------- |
| `bgImage`, `backgroundImage` | `background-image` | `assets`, `gradients` |
## Background Gradient
Properties to create a background gradient based on color stops.
```jsx
<Box bgGradient="to-r" gradientFrom="red.200" gradientTo="blue.200" />
```
| Prop | CSS Property | Token Category |
| -------------- | ------------------ | -------------- |
| `bgGradient` | `background-image` | `gradients` |
| `textGradient` | `background-image` | `gradients` |
| `gradientFrom` | `--gradient-from` | `colors` |
| `gradientTo` | `--gradient-to` | `colors` |
| `gradientVia` | `--gradient-via` | `colors` |
|