backdrop-pattern
A decorative background behind its content: a grid, dots, a soft gradient mesh, film grain, or an aurora. Drawn in CSS from the theme's colours, so it follows light, dark and any theme. It's hidden from screen readers and never takes clicks or focus; with animated the mesh and aurora drift slowly, and stay still for visitors who asked for less motion. fade softens the edges toward the page. size is the grid or dot spacing.
Ship components, not frameworks
One file each, in any stack.
This one has no events: it shows what it's given.
Source: backdrop-pattern.zb, and its registry item.
Install
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/backdrop-pattern.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/backdrop-pattern.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/backdrop-pattern.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/backdrop-pattern.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/backdrop-pattern.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/backdrop-pattern.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/backdrop-pattern.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/backdrop-pattern.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/backdrop-pattern.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/backdrop-pattern.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/backdrop-pattern.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/backdrop-pattern.json
<link rel="stylesheet" href="https://zubra-js.github.io/zubra-ui/themes/default.css">
<script type="module" src="https://zubra-js.github.io/zubra-ui/cdn/backdrop-pattern.js"></script>The compiled install writes src/components/zubra/backdrop-pattern.js and the theme, and adds @zubra/runtime to your dependencies. The one-file install writes the same path as a plain custom element that needs nothing installed (or download it and load it with a <script type="module">); it's smaller on a page with one to three components, the shared runtime with more.
Usage
<backdrop-pattern pattern="aurora">
<div class="demo-hero">
<h2>Ship components, not frameworks</h2>
<p>One file each, in any stack.</p>
</div>
</backdrop-pattern>
<script type="module">
import './components/zubra/backdrop-pattern.js';
const element = document.querySelector('backdrop-pattern');
element.animated = true;
</script>import './components/zubra/backdrop-pattern.js';
const animated = true;
export function BackdropPatternExample() {
return (
<backdrop-pattern pattern="aurora" animated={animated}>
<div className="demo-hero">
<h2>Ship components, not frameworks</h2>
<p>One file each, in any stack.</p>
</div>
</backdrop-pattern>
);
}<script setup>
import './components/zubra/backdrop-pattern.js';
const animated = true;
</script>
<template>
<backdrop-pattern pattern="aurora" :animated.prop="animated">
<div class="demo-hero">
<h2>Ship components, not frameworks</h2>
<p>One file each, in any stack.</p>
</div>
</backdrop-pattern>
</template>
<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) --><script>
import './components/zubra/backdrop-pattern.js';
const animated = true;
</script>
<backdrop-pattern pattern="aurora" {animated}>
<div class="demo-hero">
<h2>Ship components, not frameworks</h2>
<p>One file each, in any stack.</p>
</div>
</backdrop-pattern>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/backdrop-pattern.js';
@Component({
selector: 'app-backdrop-pattern-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<backdrop-pattern pattern="aurora" [animated]="animated">
<div class="demo-hero">
<h2>Ship components, not frameworks</h2>
<p>One file each, in any stack.</p>
</div>
</backdrop-pattern>
`,
})
export class BackdropPatternExample {
animated = true;
}API
| Property | Type | Default |
|---|---|---|
pattern | "grid" | "dots" | "mesh" | "grain" | "aurora" | "grid" |
size | string | "24px" |
fade | boolean | true |
animated | boolean | false |
| Slot | For |
|---|---|
(default) | What sits on the background. |
Size
1.3 KB gzipped for the component, plus the runtime, which every Zubra component on a page shares (up to 22.1 KB, all of it). On its own, with the parts of the runtime it uses, it's 17.5 KB.