{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "shader-effects-inc-shaders--write-custom-shader-component",
 "repo": "shader-effects-inc/shaders",
 "repo_url": "https://github.com/shader-effects-inc/shaders",
 "repo_slug": "shader-effects-inc-shaders",
 "title": "Write a custom WebGPU component with defineShader",
 "page_title": "How to write a custom WebGPU component with defineShader with Shaders",
 "summary": "Define a new effect with props and a WGSL pixel function, then mount it like any other component.",
 "who": "An experienced front-end or graphics developer who needs an effect that the built-in library does not provide.",
 "problem": "Off-the-shelf components may not match a specific visual, and building a GPU effect from nothing is costly.",
 "outcome": "A reusable custom component with typed props, mounted in a page alongside the built-in effects.",
 "steps": [
  "Read the Custom Components guide at https://shaders.com/docs/guide/custom-shaders and the Primitives reference.",
  "Create a file that imports defineShader, wgsl, transformColor, and transformPosition from 'shaders/std'.",
  "Define the component with a name, a props object with defaults and transforms, and a paint wgsl block.",
  "Mount the new component in your page the same way as a built-in component and check the rendered output."
 ],
 "agent_prompt": "In the shader-effects-inc/shaders repo, write a custom defineShader component named <component-name> in <project-path> that draws <effect-description>. Expected output: one new component file and a page that mounts it. Verify that the wgsl paint block returns a vec4f and that the props match the defaults.",
 "agents": [
  "any"
 ],
 "difficulty": "Advanced",
 "time": "60 minutes",
 "basis": "readme",
 "caveat": "The README marks composing from std primitives as experimental and writing WGSL directly as stable, so prefer the WGSL route for production work.",
 "category": "Content",
 "tags": [
  "Content"
 ],
 "lang": "typescript",
 "requirements": [
  "Node.js and npm to install the shaders package",
  "A project using React, Vue, Svelte, Solid, or plain JavaScript",
  "A browser with WebGPU support for the effects to render",
  "A free shaders.com account if you want to use the design editor or CLI sync"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.6,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/shader-effects-inc-shaders/write-custom-shader-component/",
 "md": "https://dedupedai.com/use-cases/shader-effects-inc-shaders/write-custom-shader-component/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/shader-effects-inc-shaders--write-custom-shader-component.json",
 "api_version": "v1"
}
