Get started
Install Shader UI in a React or Next.js project, or without a framework.
Install
React and Next.js
npm i @shader-ui/reactWithout a framework (TypeScript, PHP, CMS)
npm i @shader-ui/coreFirst component
Import the styles once, wrap the app, then write correct HTML: the state is read from it (native validity, aria-invalid, aria-busy), light follows.
// app/layout.tsx
import "@shader-ui/react/styles.css";
import { ShaderProvider } from "@shader-ui/react";
export default function Layout({ children }) {
return <ShaderProvider>{children}</ShaderProvider>;
}<Form guide onSubmit={save /* une promesse : bouton occupé, double clic ignoré */}>
<label htmlFor="email">E-mail (obligatoire)</label>
<Input id="email" type="email" required aria-describedby="email-aide" />
<p id="email-aide">Pour confirmer le compte.</p>
<Button type="submit">Créer le compte</Button>
</Form>Best practices
Link a text to every error
Light doubles information, it never carries it alone (WCAG 1.4.1). A field in error must have a message linked with aria-describedby or aria-errormessage; without it, the library shows a warning in the console.
Return a promise on submit
When onSubmit returns a promise, the button gets aria-busy, a second click is ignored, and the end of the submission lights up: green if the promise resolves, coral if it rejects.
Server-side checks
During a check (name already taken, promo code), set aria-busy on the field, and keep aria-invalid until the new answer: removing it earlier would turn the field green by mistake. Put a timer on the keyup and input events so you don't send a request on every keystroke.
Debug mode
An effect doesn't play? Open the browser console and type shaderUI.debug(): the library analyzes the page (handled elements, visibility, light backgrounds, canvas size), then explains every skipped effect. The mode stays on for the tab, reloads included. Nothing to add to your code, with or without a bundler.
shaderUI.debug() // analyze the page, then explain every skipped effect
shaderUI.debug(false) // turn it off
shaderUI.status() // environment, renderer, active effectsUse cases
Create an account, place an order, subscribe, choose delivery: real situations, live. Use cases