A honeycomb of hexagon outlines that fills its parent, with an optional edge fade and a slow drift.
Optional, and kept apart.
Nothing here is included in a project unless you add it, and the plain component it builds on is unchanged. This effect is decoration: it is hidden from screen readers, stands still for visitors who prefer reduced motion, and can be paused. Use Still on a preview to see that version.
Honeycomb
Hexagon outlines, 24 pixel radius
import { HexagonPattern } from "@rdloom/react";
export default function HexagonPatternExample() {
return (
<div className="flex w-full justify-center">
<div className="relative flex h-96 w-full items-center justify-center overflow-hidden rounded-xl border border-[var(--rd-color-border-default)] bg-[var(--rd-color-surface-default)]">
<HexagonPattern fade={false} />
<div className="relative text-center">
<p className="text-4xl font-semibold tracking-tight text-[var(--rd-color-text-default)]">Honeycomb</p>
<p className="text-base text-[var(--rd-color-text-muted)]">Hexagon outlines, 24 pixel radius</p>
</div>
</div>
</div>
);
}Installation
npx rdloom add hexagon-patternCopies the source into src/components/rdloom. Edit it freely: rdloom upgrade merges later versions into your changes.
Use another registry client
npx shadcn@latest add https://rdloom.vimalbhatt.com/r/hexagon-pattern.jsonWorks, but without upgrade tracking.
Usage
import { HexagonPattern } from "@rdloom/react";
<div className="flex w-full justify-center">
<div className="relative flex h-96 w-full items-center justify-center overflow-hidden rounded-xl border border-[var(--rd-color-border-default)] bg-[var(--rd-color-surface-default)]">
<HexagonPattern fade={false} />
<div className="relative text-center">
<p className="text-4xl font-semibold tracking-tight text-[var(--rd-color-text-default)]">Honeycomb</p>
<p className="text-base text-[var(--rd-color-text-muted)]">Hexagon outlines, 24 pixel radius</p>
</div>
</div>
</div>Faded
Smaller cells
Fading toward the edges
import { HexagonPattern } from "@rdloom/react";
export default function HexagonPatternExample() {
return (
<div className="flex w-full justify-center">
<div className="relative flex h-96 w-full items-center justify-center overflow-hidden rounded-xl border border-[var(--rd-color-border-default)] bg-[var(--rd-color-surface-default)]">
<HexagonPattern size={18} fade />
<div className="relative text-center">
<p className="text-4xl font-semibold tracking-tight text-[var(--rd-color-text-default)]">Smaller cells</p>
<p className="text-base text-[var(--rd-color-text-muted)]">Fading toward the edges</p>
</div>
</div>
</div>
);
}Animated
Slow drift
Stops for reduced motion
import { HexagonPattern } from "@rdloom/react";
export default function HexagonPatternExample() {
return (
<div className="flex w-full justify-center">
<div className="relative flex h-96 w-full items-center justify-center overflow-hidden rounded-xl border border-[var(--rd-color-border-default)] bg-[var(--rd-color-surface-default)]">
<HexagonPattern animated fade />
<div className="relative text-center">
<p className="text-4xl font-semibold tracking-tight text-[var(--rd-color-text-default)]">Slow drift</p>
<p className="text-base text-[var(--rd-color-text-muted)]">Stops for reduced motion</p>
</div>
</div>
</div>
);
}API Reference
Defined by the spec. Components also accept the props of the React Aria component they wrap.
| Prop | Type | Default |
|---|---|---|
sizeHexagon radius (centre to corner) in pixels. | number | 24 |
strokeWidthLine thickness in pixels. | number | 1 |
colorColour of the pattern: any CSS colour or a token such as var(--rd-color-border-default). | string | "color-mix(in srgb, var(--rd-color-text-default) 16%, transparent)" |
fadeFades the pattern out toward its edges. | boolean | true |
animatedDrifts the pattern slowly, one tile per cycle. Off by default. | boolean | false |
isStillStops the drift. Moving content should be stoppable. | boolean | false |
durationSeconds one drift cycle takes. | number | 12 |
Accessibility
Role presentation, WCAG 2.2 AA. Tested with axe and keyboard tests; screen reader checks are in the audit checklist.
Keyboard
Not interactive.
Screen readers announce
- Ignored: it is not announced
What your code must do
- Pure decoration: aria-hidden, never focusable, and pointer-events none so content on top stays usable
- It is drawn with CSS only, so it needs no JavaScript and is safe in server HTML
- Stands still for visitors who ask for less motion (prefers-reduced-motion), with isStill, and inside an rdm-still container
- Drift is slow and never flashes (WCAG 2.2.2, 2.3.1)
- Hidden in forced-colors (high contrast) mode so it never fights system colours
- Keep text on top at 4.5:1 against the lines: use a low-contrast token for the pattern
Guidelines
Use it when
- A quiet honeycomb behind a hero, card or empty state
- Giving a flat surface a little texture
Avoid it when
- Behind long text where the lines reduce legibility
- As the only way to show a boundary or meaning
Don't
- A high-contrast colour that competes with the content
- Animating several patterns on one screen
Design tokens
The semantic tokens this component uses. Change them once and every component follows; see Design tokens.
--rd-color-border-default