Theming & intensity
Tokens
Yan uses shadcn's token names, so components drop into an existing shadcn theme. On top of those it adds a candy palette:
:root {
--primary: oklch(0.8 0.135 355); /* sakura */
--secondary: oklch(0.83 0.095 300); /* lavender */
--yan-mint: oklch(0.88 0.1 165);
--yan-sky: oklch(0.86 0.08 230);
--yan-lemon: oklch(0.94 0.12 98);
--yan-peach: oklch(0.87 0.09 50);
/* the "edge" under a candy surface */
--yan-sakura-edge: oklch(0.65 0.19 355);
/* particle colors used by yan-fx */
--yan-fx-1: oklch(0.78 0.17 355);
/* … --yan-fx-5 */
}Dark mode follows shadcn's convention: put the dark class on <html>.
The intensity dial
Every Yan component accepts intensity:
"kawaii"(default): squish and jelly motion, sparkles + hearts + stars, and an onomatopoeia sticker."subtle": a small bounce and a few sparkles. Polite enough for dashboards."off": a plain component. Same styling, no motion, no particles.
yan-fx
All particles come from lib/yan-fx.ts. You can call it directly:
import { burst } from "@/lib/yan-fx"
// at a point in the viewport…
burst({ x: 200, y: 120 }, { shapes: ["heart"], count: 12, word: "ドキッ" })
// …or at the center of an element
burst(document.querySelector("#save")!, { shapes: ["petal"], count: 20 })| Prop | Type | Default |
|---|---|---|
shapesShapes to pick from at random. | FxShape[] | ["sparkle"] |
countNumber of particles. | number | 10 |
wordOnomatopoeia sticker drawn at the origin. | string | null | null |
colorsCSS colors or custom property names. | string[] | --yan-fx-1 … 5 |
powerVelocity multiplier. | number | 1 |
sizeBase particle size in px. | number | 9 |
angle / spreadAim the burst (radians). | number | up / full circle |
gravityDownward pull in px/s². | number | 420 |
burst() is only one word in the vocabulary. The rest are small, authored
effects that components combine into a beat:
import { bloom, emote, fly, impact, puff, speedLines } from "@/lib/yan-fx"
impact(button) // soft glow + emphasis lines + clouds off both ends
puff(el, { count: 3 }) // "pofu" clouds, animated on twos
speedLines(el) // manga emphasis lines around an element
bloom(checkbox) // a sakura unfolds around it, then lets its petals go
emote(el, "!") // an emotion mark popping off a corner
fly(option, trigger) // a heart that arcs from one element to anotherEvery one of them is a no-op under prefers-reduced-motion: reduce.
Shapes:
sparkle,heart,star,petal,bubble,dot,puff. Colors accept any CSS color or a custom property name such as"--yan-fx-3".