@grigogo/ui
v0.1.0
Published
Animated React components: text effects, interactions, UI pieces and WebGL/canvas backgrounds. Zero dependencies besides React.
Downloads
91
Maintainers
Readme
@grigogo/ui
Animated React components — text effects, interactions, UI pieces and WebGL / canvas backgrounds. No dependencies besides React. Live previews, props and source: grigogo.ru/library.
npm i @grigogo/uiimport { Aurora, GlitchText } from '@grigogo/ui';
export default function Hero() {
return (
<section style={{ position: 'relative', height: 480 }}>
<Aurora />
<h1>
<GlitchText text="Signal lost" />
</h1>
</section>
);
}Tune it on your own page
Wrap a component in <Tune> while you work: a panel with the same faders as on grigogo.ru appears in the corner, every change shows up on your real page, and Copy JSX gives you the result to paste.
import { Tune } from '@grigogo/ui/tune';
<Tune>
<Aurora />
</Tune>;Several <Tune>s share one panel, a tab each. In a production build <Tune> renders only its child — the panel, its styles and the control schema are dropped from the bundle — so leaving it in is harmless; remove it when you're done. Panel language: <Tune lang="ru">.
One rhythm for the whole app
Wrap your app in <GrigogoProvider> and every component follows one accent colour and one tempo:
import { GrigogoProvider } from '@grigogo/ui';
<GrigogoProvider accent="#ff3d7f" tempo={1.5}>
<App />
</GrigogoProvider>;- Accent replaces the brand green wherever a component uses it; tempo speeds everything up (2 = twice as fast) or slows it down.
- A prop you set wins.
<Aurora speed={0.5} />keeps its own speed while the rest follow the tempo. Remove the prop and it follows again;rhythm={false}keeps a component out entirely. enabled={false}switches the rhythm off; nested providers override only what they set.- With
<Tune>on the page the panel gets a Rhythm tab; component fields that follow it are marked shared, and ↺ sends an overridden one back.
Without a provider nothing changes.
Light on the device
Every animated component shares one animation frame, stops completely while off screen, and canvas/WebGL backgrounds lower their resolution while the device can't keep up — then restore it.
Why
- Styles come with the component. Nothing extra to import.
- Tree-shakable. Each component is its own module; you ship only what you import.
- Typed. Every component exports its props type, e.g.
GlitchTextProps. - Next.js ready. Modules are marked
'use client'; render them from server components as usual. - Respects
prefers-reduced-motion.
Requires React 18 or newer. Prefer to own the code? Every component can also be copied from the site as a single file.
MIT © Grigory Rozhkov
