---
title: Background patterns
summary: Use background pattern utilities to add subtle textures to elements. Combine pattern type, color, and size modifiers for different visual effects.
description: Add decorative background patterns with utility classes.
added-in: '1.5.0'
related: [/ui/utilities/gradients]
---
import Example from '@components/Example.astro'
import Illustration from '@ui/Illustration.astro'
import site from '@data/site.json'
export const patterns = ['diagonal', 'diagonal-2', 'dots', 'rectangles', 'lines', 'lines-vertical', 'grid', 'grid-diagonal', 'blueprint', 'cross-dots', 'circles', 'diagonal-stripes', 'diagonal-stripes-2', 'zigzag', 'vertical-stripes', 'horizontal-stripes']
export const colors = Object.entries(site.colors)
## Overview
Background pattern utilities let you apply decorative, repeatable textures to elements like cards, sections, and placeholders. Start with a pattern type class, then optionally combine it with color and size modifiers.
```html
```
## Pattern types
Use one of the available pattern classes to define the shape and direction of the texture:
{patterns.map((pattern) => (
-
.bg-pattern-{pattern}
))}
Here are the available pattern types:
{patterns.map((pattern, i) => {
return (
)
})}
{patterns.map((pattern) => (
))}
## Pattern colors
Combine any pattern with color modifiers using `.bg-pattern-{color}`. See the [full list of available colors](/ui/base/colors) for all color names.
{colors.map((color) => (
))}
{colors.map((color) => (
))}
## Transparent pattern utility
Use `.bg-pattern-transparent` when you need a checkerboard-style transparent background. Combine it with spacing and border classes. You can change strength with `--tblr-pattern-opacity` (include the `%` unit).
## Pattern sizes
Use size utilities to control pattern density:
- `.bg-pattern-sm`
- `.bg-pattern-md`
- `.bg-pattern-lg`
- `.bg-pattern-xl`
Look at the following examples to see how the pattern sizes work:
## Pattern opacity
Use opacity utilities to control how strong the texture is:
- `.bg-pattern-opacity-lighter`
- `.bg-pattern-opacity-light`
- `.bg-pattern-opacity-dark`
- `.bg-pattern-opacity-darker`
.bg-pattern-opacity-lighter
.bg-pattern-opacity-light
.bg-pattern-opacity-darker
## Examples
Look at the following examples to see how background patterns can be used in real layouts.
### Card on a background pattern
Placing a card on a patterned background adds a decorative touch to the surrounding area while keeping the card itself clean. Wrap the card in an element with a `.bg-pattern-*` class so the pattern shows around the card without affecting the readability of its content.
Here is an example of a card placed on a background pattern.
## Accessibility
Background patterns are decorative and should never reduce content readability:
- Keep sufficient contrast between text and background.
- Prefer placing patterns on containers around text-heavy content, not directly behind long paragraphs.
- For callouts and alerts, test color and pattern combinations in both light and dark contexts.
## Best practices
- Start with `.bg-pattern-sm` for dense UIs and increase size only when needed.
- Avoid stacking multiple decorative backgrounds in the same section.
- Use strong pattern colors on small surfaces (headers, badges, callouts), and subtler combinations on large sections.