Fluorite
React package

Components

The Shader component and the ShaderProvider.

<Shader>

Shows a published shader. Pass version or draft (not both) to choose what's shown, or neither for the latest version. See Embeds.

PropTypeDefaultNotes
idstringrequiredShader id
versionstringlatestPin a published version
draftstringnonePreview token, to render the draft instead
inputsRecord<string, number | boolean | number[] | string>noneValues for exposed inputs, by name
outputstringmain outputRender a named output instead
className / stylen/anoneApplied to the wrapper element
play"visible" | "always" | "hover" | false"visible"When the animation runs
revalidatenumberoffCheck for new versions every N ms
revalidateOnFocusbooleanfalseCheck again when the window regains focus
dprnumber | [min, max][1, 2]Device-pixel-ratio clamp
maxFpsnumberuncappedThrottle the frame rate
forceWebGLbooleanfalseSkip WebGPU, render on WebGL2
loadingReactNodenoneShown while loading
fallbackReactNodenoneShown on error, or on an unsupported device
clientShaderClientshared defaultPoint this one embed somewhere else
onReady(info) => voidnoneGives you { animated, backend }
onError(error: ShaderError) => voidnoneSwitch on error.code
onStateChange(state: ShaderState) => voidnoneFollow the loading state
throwOnErrorbooleanfalseRethrow to an error boundary

Styling hooks

Style the wrapper with CSS using its data attributes:

  • data-state: idle, fetching, compiling, ready, paused, error
  • data-backend: webgpu or webgl
  • data-animated: whether the shader changes over time

<ShaderProvider>

Embeds need no configuration. Use a provider only to point a group of embeds at a different host:

import { ShaderProvider } from "@fluorite-studio/react";

<ShaderProvider config={{ baseUrl: "https://your-host" }}>
  {children}
</ShaderProvider>;
PropTypeNotes
configClientConfig{ baseUrl?, fetch?, cache?, ttlMs? }
clientShaderClientA pre-built client, which takes precedence

baseUrl also reads NEXT_PUBLIC_FLUORITE_BASE_URL when it is set.

On this page