Snake Loader
A progress loader whose visual is a tiny snake board. The snake plays itself while you wait, progress fills a row of tiles beneath it, and the status line carries the label, current step and percentage. Done offers continue; an error crashes the snake and offers a retry. Click the board and the snake is yours.
Try it: Watch it load — or click the board (or press an arrow key) to steer the snake while you wait.
Installation
Install with the shadcn CLI:
npx shadcn@latest add https://www.framekitui.live/r/snake-loader.jsonOr, with the @framekit namespace registered: npx shadcn@latest add @framekit/snake-loader. You can also copy the source into components/ui/snake-loader.tsx (view on GitHub).
Usage
import { SnakeLoader } from '@/components/ui/snake-loader'Props
| Prop | Type | Default | Notes |
|---|---|---|---|
progress | number | — | 0–100, drawn as a row of tiles plus a counting percentage. Omit for an indeterminate wave. 100 counts as done. |
state | 'loading' | 'done' | 'error' | 'loading' | Done shows a check; error crashes the snake, tints the tiles rose and is announced as an alert. |
label / description | string | 'Loading' | Status line and an optional secondary line (current step, counts, ETA). |
readyLabel / errorLabel | string | 'Ready' / 'Something went wrong' | Status line for the done and error states. |
onContinue / continueLabel | () => void / string | 'Continue' | Adds a continue button when done. |
onRetry / retryLabel | () => void / string | 'Try again' | Adds a retry button on error. |
showPercent / showProgress | boolean | true | Hide the percentage or the tile progress row. |
variant | 'card' | 'plain' | 'card' | plain drops the card surface so the loader sits inside your own layout. |
color | string | — | Accent (#rrggbb) for the snake, trail and progress. Defaults to emerald. |
interactive | boolean | true | Let people take over the snake. false makes it a pure animation. |
autoPlay | boolean | true | The snake plays itself (always off under reduced motion). |
cols / rows | number | 18 / 10 | Board size in tiles (cols 10–30, rows 6–20). |
speed / wrap | number / boolean | 120 / false | ms per step while someone plays; wrap makes walls pass-through. |
skin | 'tiles' | 'lcd' | 'tiles' | Glossy snake on soft tiles, or a pixel nod to the classic phone screen. |
theme | 'auto' | 'light' | 'dark' | 'auto' | auto follows the nearest .dark / .light ancestor. |
onGameOver | (score, best) => void | — | Fires when a played round ends. |
className / boardClassName | string | — | Style the wrapper and the board. |
Dependencies
motionlucide-react
Related Loading components
- Login Gate Intro
A lock-screen preloader: oversized clock, generated avatar card, a password field that types itself, a three-step sign-in sequence, then the site fades up. Skip link included; reduced motion opens…
- Lattice Pulse Loader
3×3 nodes pulse in a traveling wave.
- Cook Loading
An illustrated chef stirs a sizzling wok while your app loads — eight original cooking poses, drifting steam, real progress and ready/error states in one self-contained component.
- Particle Morph Loader
A depth-lit swarm of motes spins in 3D and melts between sphere, ribbon, shell, tetra, ring and helix while a status word rolls underneath.
- Hourglass Loader
A brass-and-glass hourglass: sand drains from the upper bulb through a trickling stream into a growing mound, and in endless mode the glass turns itself over on a spring when the top runs dry. Pass…
- Ghost Gobbler Skull
A glossy vinyl-toy skull that tracks little black-smoke ghosts drifting in from every direction, drops its jaw, slurps each one in like spaghetti and CHOMPS — then levels up: glowing eyes, blush…