Pixel Canvas
A decorative canvas grid of square pixels that light up under the cursor and smoothly fade back — or, with the idle + twinkle props, an ambient pixel-stars field, or with the flow prop, autonomous organic shapes (a drifting metaball field) rendered as pixels. Token-derived colors, default/trail/glow variants.
Preview
Controls
Device view renders in an isolated frame so real responsive breakpoints apply. Switch to Full for overflowing popovers.
Installation
php artisan ui:add pixel-canvas
Behavior layer (Alpine)
This component installs a self-registering Alpine module to
resources/js/ui/pixel-canvas.js. Import the behavior layer once
from your bundle so it loads (it hooks alpine:init):
import './pixel-canvas.js';
Registry contract
Install confidence
php artisan ui:add pixel-canvas
writes only the generated targets below. The CLI validates each file hash before writing and
prompts before replacing local changes unless --force is used.
- Version
- 1.2.0
- License
- open
- Stability
- stable
- Contract
- v2
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/components/ui/pixel-canvas.blade.php |
| js | resources/js/ui/pixel-canvas.js |
Registry dependencies
None.
Package dependencies
composer: jml/brok:^1.0
npm: alpinejs
Guidance
Expressive and showcase effectSupport brand expression or a showcase moment.
Use when
- Use only when visual expression supports storytelling, brand differentiation, or a clear showcase moment. Do not place heavy effects in task-dense workflows where clarity, speed, and readability matter more.
Avoid when
- Avoid using pixel-canvas as a default simply because it is available in the library. Choose it only when its interaction cost, visibility, and behavior match the job to be done.
- Task length
- short
- Interaction cost
- medium
- Interruptiveness
- low
- Input precision
- none
- Mobile / touch risk
- high
- Accessibility risk
- high
- Needs background context
- No
- Comparison needed
- No
Preferred alternatives
- Static content-first presentation
Anti-patterns
- Heavy effects in forms or task-dense workflows
- Motion that interferes with reading or focus
API
manifest knowledge + registry-derived coverageProps
| Prop | Type / values | Default | Description |
|---|---|---|---|
| gap | int | 6 | Declared by @props in the registry Blade source. |
| speed | int | 35 | Declared by @props in the registry Blade source. |
| variant | string | default | Declared by @props in the registry Blade source. |
| colors | mixed|null | null | Declared by @props in the registry Blade source. |
| idle | int | 0 | Declared by @props in the registry Blade source. |
| twinkle | int | 0 | Declared by @props in the registry Blade source. |
| flow | int | 0 | Declared by @props in the registry Blade source. |
Slots
Components use the default Blade slot unless a documented subcomponent is installed by the registry item.
Data slots
pixel-canvas
Capabilities
Behavior
- Uses server-rendered Blade and semantic HTML.
- Installs a JavaScript behavior module when the registry item includes resources/js/ui files.
- Declares registry capability flags: a11y, interactive, responsive, rtl, darkMode, localized, reducedMotion.
Usage
<div class="relative h-56 w-full max-w-md overflow-hidden rounded-lg border border-border bg-card text-primary">
<x-ui.pixel-canvas />
</div>
Variants
{{-- Opt-in props turn the cursor-reactive grid into two ambient effects, both
default off so the cursor-only look is unchanged: idle + twinkle give a
"pixel stars" field (uicapsule.com "background pixels"), and flow gives
autonomous drifting organic shapes (uicapsule.com "background shapes"). --}}
<div class="grid w-full gap-6 sm:grid-cols-2">
{{-- Ambient stars: a faint resting dot-grid (idle) with random cells twinkling
in token palette colors (twinkle), independent of the cursor. A low speed
lets each glint linger before fading. --}}
<figure class="space-y-2">
<div class="relative h-48 w-full overflow-hidden rounded-lg border border-border bg-card text-primary">
<x-ui.pixel-canvas :gap="10" :speed="14" :idle="0.06" :twinkle="18" />
</div>
<figcaption class="text-xs text-muted-foreground">{{ __('Ambient stars — idle grid + twinkle') }}</figcaption>
</figure>
{{-- Denser, faster twinkle over a brighter resting grid, glow variant for a
soft bloom on each lit cell. --}}
<figure class="space-y-2">
<div class="relative h-48 w-full overflow-hidden rounded-lg border border-border bg-card text-primary">
<x-ui.pixel-canvas variant="glow" :gap="8" :speed="20" :idle="0.1" :twinkle="40" />
</div>
<figcaption class="text-xs text-muted-foreground">{{ __('Dense glow twinkle') }}</figcaption>
</figure>
{{-- Twinkle with no resting floor: stars glint and fade to black, no base grid. --}}
<figure class="space-y-2">
<div class="relative h-48 w-full overflow-hidden rounded-lg border border-border bg-card text-primary">
<x-ui.pixel-canvas :gap="12" :speed="10" :twinkle="12" />
</div>
<figcaption class="text-xs text-muted-foreground">{{ __('Twinkle only — no resting grid') }}</figcaption>
</figure>
{{-- Idle only: a calm, always-visible dot-grid that still lights under the
cursor (hover it), with no autonomous twinkle. --}}
<figure class="space-y-2">
<div class="relative h-48 w-full overflow-hidden rounded-lg border border-border bg-card text-primary">
<x-ui.pixel-canvas :gap="10" :speed="30" :idle="0.08" />
</div>
<figcaption class="text-xs text-muted-foreground">{{ __('Idle grid only — hover to light') }}</figcaption>
</figure>
{{-- The `flow` prop turns the same grid into autonomous, drifting organic
shapes — a metaball field sampled per cell (uicapsule.com "background
shapes"). Reads best with a chunkier gap. --}}
<figure class="space-y-2">
<div class="relative h-48 w-full overflow-hidden rounded-lg border border-border bg-card text-primary">
<x-ui.pixel-canvas :gap="14" :flow="1" />
</div>
<figcaption class="text-xs text-muted-foreground">{{ __('Flowing shapes — drifting metaball field') }}</figcaption>
</figure>
{{-- Flowing shapes over a faint resting grid (idle), so the pixels read even
where the blobs are absent — the full "background shapes" look. --}}
<figure class="space-y-2">
<div class="relative h-48 w-full overflow-hidden rounded-lg border border-border bg-card text-primary">
<x-ui.pixel-canvas :gap="16" :flow="1.4" :idle="0.05" />
</div>
<figcaption class="text-xs text-muted-foreground">{{ __('Shapes over a faint resting grid') }}</figcaption>
</figure>
{{-- Glow variant: each lit cell blooms, giving the shapes a hazy edge. --}}
<figure class="space-y-2">
<div class="relative h-48 w-full overflow-hidden rounded-lg border border-border bg-card text-primary">
<x-ui.pixel-canvas variant="glow" :gap="14" :flow="1" />
</div>
<figcaption class="text-xs text-muted-foreground">{{ __('Glow shapes') }}</figcaption>
</figure>
{{-- All three layers at once: flowing shapes + ambient twinkle + cursor light
(hover) composed over one grid. --}}
<figure class="space-y-2">
<div class="relative h-48 w-full overflow-hidden rounded-lg border border-border bg-card text-primary">
<x-ui.pixel-canvas :gap="12" :flow="1.2" :twinkle="14" :idle="0.04" />
</div>
<figcaption class="text-xs text-muted-foreground">{{ __('Shapes + twinkle + hover') }}</figcaption>
</figure>
</div>
Accessibility & localization
data-slot
Keyboard focus-visible
Localized labels
- Accessibility target: wcag-2.2-aa-target.
- Uses semantic HTML and a stable
data-slotattribute for styling/scripting hooks. - Focus-visible rings use the
ringtoken so keyboard focus is always visible. - Disabled and invalid states are conveyed to assistive tech, not by color alone.
- Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces above.
- Labels go through
__()and the component uses logical properties (ms-*,text-start,start-*) so it mirrors correctly — flip the preview to RTL to confirm.
Source
The exact, editable file ui:add writes
into your app — copy it or own the whole thing. Previews
render this same code; there are no preview-only components.
Changelog
Current version: v1.2.0. See the site changelog for the full release history.