shaders README

The project's README from github.com/shader-effects-inc/shaders. As one markdown file: README.md.

Shaders

WebGPU effects as components
for React, Vue, Svelte, Solid and JavaScript

npm version npm downloads per month jsDelivr hits (npm) NPM License

Shaders

npm install shaders

Table of Contents

  1. Why Shaders?
  2. 🧩 Components
  3. 🎨 Design visually, export code
  4. ⌨️ CLI
  5. 🤖 Using Shaders with AI
  6. ⚡️ Shaders Pro
  7. 🧪 Build your own component
  8. 👩🏻‍⚖️ License
  9. 💎 Contribute

Why Shaders?

🧩 Components

Every effect is a component. <Shader> renders the canvas; its children are layers, evaluated top to bottom and blended on the GPU.

React

import { Shader, LinearGradient, CursorTrail } from 'shaders/react'

<Shader className="w-full h-64">
  <LinearGradient colorA="#0f172a" colorB="#7c3aed" />
  <CursorTrail />
</Shader>

Get started with Shaders for React.

Vue

<script setup>
import { Shader, LinearGradient, CursorTrail } from 'shaders/vue'
</script>

<template>
  <Shader class="w-full h-64">
    <LinearGradient colorA="#0f172a" colorB="#7c3aed" />
    <CursorTrail />
  </Shader>
</template>

Get started with Shaders for Vue.

Svelte

<script>
  import { Shader, LinearGradient, CursorTrail } from 'shaders/svelte'
</script>

<Shader class="w-full h-64">
  <LinearGradient colorA="#0f172a" colorB="#7c3aed" />
  <CursorTrail />
</Shader>

Get started with Shaders for Svelte.

Solid

import { Shader, LinearGradient, CursorTrail } from 'shaders/solid'

<Shader class="w-full h-64">
  <LinearGradient colorA="#0f172a" colorB="#7c3aed" />
  <CursorTrail />
</Shader>

Get started with Shaders for Solid.

JavaScript

import { createShader } from 'shaders/js'

await createShader(document.getElementById('my-shader'), {
  components: [
    { type: 'LinearGradient', props: { colorA: '#0f172a', colorB: '#7c3aed' } },
    { type: 'CursorTrail' },
  ],
})

Get started with Shaders for JavaScript.

Browse all 200+ components, each with a live preview and every prop documented.

🎨 Design visually, export code

Most people don't write their effects by hand. They design them.

The design editor at shaders.com is an infinite canvas where you stack components, tune every prop with real controls, drive props from the cursor or a timeline, and see the result live. When it looks right, Export Code gives you the component tree in your framework, ready to paste.

Design and export are free with an account. Your work is saved as projects you can come back to.

Open the design editor

⌨️ CLI

The CLI connects a codebase to your Shaders account, so the effects you design land in your project as real component files and stay in sync.

npx shaders connect        # link this codebase to a Shaders project
npx shaders install        # pick shaders from that project; writes component files
npx shaders update         # pull in what you changed in the editor

It detects your framework, writes to your components folder, and records what it installed in a lock file. Nothing to install globally.

Read the CLI guide.

🤖 Using Shaders with AI

Give your coding agent the same tools you have:

⚡️ Shaders Pro

Everything above is free. Pro adds the library and the workflow around it:

See pricing

🧪 Build your own component

If you need a brand new component, you can write one. A component is a plain object passed to defineShader: a name, its props, and what to draw at each pixel. Mount it with <CustomShader> like any other component.

import { defineShader, wgsl, transformColor, transformPosition } from 'shaders/std'

export const Halo = defineShader({
  name: 'Halo',
  props: {
    color: { default: '#ffd166', transform: transformColor },
    center: { default: { x: 0.5, y: 0.5 }, transform: transformPosition },
    radius: { default: 0.6 },
  },
  paint: wgsl`
    let d = length((uv - center) * vec2f(aspect, 1.0)) / radius;
    return vec4f(color.rgb, 1.0 - smoothstep(0.8, 1.0, d));
  `,
})

The guide covers both ways to write the pixel part: composing it from the std primitives (experimental) or writing WGSL directly (stable). Custom Components · Primitives reference

👩🏻‍⚖️ License

💎 Contribute

Issues and pull requests are welcome. View the contributing guide before starting, and for anything more than a bug fix, open an issue to discuss it before the PR.

The engine lives in packages/core, with one folder per component under src/shaders/. The framework packages are generated from it.

pnpm install
pnpm lib:build   # build every package (regenerates the registry and framework components)
pnpm test        # the engine's test suite

Say hello on Discord.


Shaders © Shader Effects, Inc.

shaders (shader-effects-inc/shaders)

Searching Database…

5.1K ·GitHub
这是什么?Shaders 是一个包含 200 多种 WebGPU 视觉效果的库(渐变、噪点、玻璃、金属、光效、扭曲、转场、模糊、光标效果),以开箱即用的组件形式提供给 React、Vue、Svelte、Solid 和纯 JavaScript。
这是单一框架,还是每个框架都有各自的包?它是一个跨框架组件库:React、Vue、Svelte、Solid 和纯 JS 各自拥有一等公民的入口,暴露相同的 props。
怎么把 Shaders 添加到我的项目里?为你的框架安装相应的包并放入效果组件,或者使用 Shaders CLI,它会连接你的 Shaders 账户、检测你的框架,并把设计好的组件写入你的 components 文件夹,同时生成锁文件以保持同步。
我需要支持 WebGPU 的浏览器吗?需要,这些效果通过真正的 WebGPU 声明式 API 渲染,因此目标浏览器需要支持 WebGPU;这些组件基于 TypeScript、SSR 安全,已在数千个生产环境中使用。
它完全是免费的,还是有一部分收费?核心引擎、全部 200 多个组件、设计编辑器、CLI 和 MCP 服务器都免费。Shaders Pro 则额外提供 1,000 多个预设、55 个以上的现成网站区块、无水印高清导出、Framer 插件和无限版本历史。
整个项目都是 MIT 许可吗?本仓库和 npm 包中的引擎、组件和框架绑定才是 MIT 许可。设计编辑器、预设、网站区块以及 shaders.com 平台的其他功能是独立的,有各自的条款。
可视化设计编辑器是做什么的?在 shaders.com 上,你可以在无限画布上设计效果,用实时控件调整每个 prop,用光标或时间线驱动 prop,然后点击 Export Code 获得与你的框架匹配的组件树,注册账户即可免费使用。
AI 编程代理能使用 Shaders 吗?可以,运行 npx shaders@latest install-mcp 会为 Claude Code、Cursor、Codex、Windsurf、Copilot 等设置 MCP 服务器,shaders.com/llms.txt 和 llms-full.txt 则为代理提供完整文档和组件参考。
我能构建自定义 shader 组件吗?可以,通过 defineShader,你创建一个包含名称、props 和逐像素绘制逻辑的普通对象,直接用 WGSL 编写(稳定)或由 std 原语组合而成(实验性),然后像其他组件一样挂载。
它面向哪些人?流行程度如何?它面向想要 GPU 效果但不想手写 WGSL 的前端和设计工程师;项目方称已有超过 16,000 名设计工程师在数千个网站上使用它。
Size
7.7 MB
Stars
5.1K
Age
19d
Commits · 90 Days