Hero Lora
A large illustrative hero SVG that animates the core LoRA motif — a frozen weight matrix W with a hatched overlay, two tiny adapters A and B that slide in and multiply, and a ghost ΔW bloom with a rank badge cycling through r=4, r=16, r=64. Theme-driven via currentColor + a single accentColor prop; reduced-motion users see a static end state.
Customize
Hero illustration
400px
accent
false
Installation
npx shadcn@latest add https://craftbits.dev/r/hero-lora.jsonUsage
import { HeroLora } from "@craft-bits/core/svg/hero-lora";
<HeroLora size={400} />
// Tint via the parent text color.
<div className="text-cb-accent">
<HeroLora />
</div>Understanding the component
- Continuous storyboard. A single
useEffectschedules the full ~8.5s cycle: W fades in, the frozen badge snaps on, adapter A slides in, B slides in, a multiplication symbol and dotted connections appear, a ghost ΔW blooms, the params caption pops, then the rank badge cycles r=4, r=16, r=64 while the adapters subtly resize, before everything fades and the loop restarts. Every timer is cleaned up on unmount and when reduced-motion changes. - Motion values, not re-renders. Adapter positions, sizes, opacities, and the ghost overlay are driven by
motion'suseMotionValue+useSpring, so the React tree never re-renders during the loop. Springs come from@craft-bits/core/motion—SPRINGS.smoothfor entrances,SPRINGS.bouncyfor adapter slides,SPRINGS.snapfor the frozen badge,SPRINGS.slowfor adapter size changes. - Theme-driven color. Base W block, hatching, grid, frozen badge, "W" label, and caption use
currentColor, so the host tints the whole illustration with anytext-cb-*utility. TheaccentColorprop colors the adapters, ghost ΔW, ΔW label, params caption, and rank badge — any CSS color (includingvar(--color-accent-500)). - Reduced-motion safe. When
prefers-reduced-motion: reduceis set, or thepausedprop istrue, the loop short-circuits to a single static end state: adapters parked at their targets, ΔW visible, rank badge at r=4.
Variants / Examples
// Paused — useful for thumbnails / OG images.
<HeroLora paused />
// Compact thumbnail.
<HeroLora size={200} />
// Explicit accent color.
<HeroLora size={480} accentColor="var(--color-accent-300)" />
// Custom hex.
<HeroLora accentColor="#8b5cf6" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
size | number | 400 | Pixel width. Height is computed from the 400×280 aspect ratio. |
accentColor | string | 'currentColor' | Any CSS color. Tints the adapters, ghost ΔW, ΔW label, params caption, and rank badge. |
paused | boolean | false | When true, render a single static end state instead of looping. |
className | string | — | Extra classes merged onto the root <svg>. |
...rest | SVGAttributes<SVGSVGElement> | — | Other SVG props forwarded to the root. |
Accessibility
- The root
<svg>carriesaria-hidden="true"— the illustration is decorative; pair it with a visible heading or caption in its surrounding context. - Motion respects
prefers-reduced-motion: reduce: the loop short-circuits and renders a static end state. - All colors flow from
currentColor+ theaccentColorprop, so contrast tracks the consumer's text and accent tokens — no hardcoded hex values.
Credits
- Extracted from:
craftingattention(app/src/lessons/primitives/chrome/icons/heroes/HeroLora.tsx). - Inspiration: the LoRA paper (Hu et al., 2021) — "don't fine-tune everything".