DEV Community

Simon Le Marchant for Shaders

Posted on

How to Use Shaders in React (2026 WebGPU / WebGL Tutorial)

We've got it easy, and that's a problem

It’s getting easier and easier to build for the frontend.

Frameworks are better. Tooling is better. AI can generate entire UI layouts. You can spin up a clean, responsive, modern-looking site in a day. But that also means everyone else can too. As the barrier to building goes down, the bar for standing out goes up.

The places where things still stand out tend to be motion, interactivity, and visuals — the parts that AI struggle with and that still feel a bit like magic. GPU-powered shaders are a big part of that next frontier.

A hero section with a liquid glass and dither background

If you’ve ever seen effects like:

  • Liquid glass distortions
  • Dithering or ASCII renders
  • Interactive ripple/distortion backgrounds
  • Animated gradients that feel alive

...those are typically powered by fragment shader math running on the GPU (via WebGL or WebGPU). The problem is that shader programming is nothing like normal frontend work. You’re suddenly dealing with trigonometry, UV coordinates, noise functions, render passes, memory buffers, and a lot of concepts that feel very far removed from writing React components or CSS.

The shaders homepage

Shader magic for modern frontends

That’s the challenge that led me to build the Shaders component library — instead of writing GLSL or WGSL directly, you work with shader effects as components that you can drop into your app, pass props to, and compose together.

You can treat GPU effects more like UI building blocks:

  • Use them in hero sections
  • Use them as animated backgrounds
  • Wrap images or SVGs with effects
  • Add interactivity with mouse position
  • Animate values over time with props

No more context switching into heavy shader math or fighting AI over floating point math — you’re working at the same level you normally work at: components and props.

Creating shader effects in 10 minutes flat

Shaders is currently in public beta, and is already being used in a bunch of production projects. It's available for Vue, React, Svelte, Solid and vanilla JS.

Here’s a short video that walks through how to use the components inside a React project, explores some of the available presets, and shows how the design editor fits into your workflow.

An example shader showing an SVG shape being used to generate a metallic logo effect

If you want to try it yourself, you can find everything here:

Docs: https://shaders.com
npm: https://www.npmjs.com/package/shaders

If you need help, or end up shipping something awesome using Shaders, let us know in Discord here: https://discord.gg/Mfqmb2jCQT

It’s never been easier to build for the web — which means it’s never been more important to build something that feels different 🔥

Top comments (0)