[{"data":1,"prerenderedAt":628,"buildId":629},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fprimitives\u002Finputs-text\u002Ftext":3,"github-stars":536,"guide-nav":538},{"id":4,"title":5,"body":6,"categoryId":519,"categorySlug":520,"categoryTitle":521,"curated":522,"description":523,"editUrl":524,"extension":525,"group":526,"groupTitle":527,"kind":528,"meta":529,"navigation":530,"path":531,"seo":532,"sourceUrl":533,"stem":534,"wordCount":524,"__hash__":535},"primitives\u002Fdocs\u002Fprimitives\u002F45.inputs-text\u002F2.text.md","text",{"type":7,"value":8,"toc":515},"minimark",[9,12,21,177,187,201,251,256,304,311,318,322,429,432,504,511],[10,11,5],"h1",{"id":5},[13,14,15,16,20],"p",{},"Text as a field: ",[17,18,19],"code",{},"label(uv).a"," is the coverage (white glyphs, anti-aliased).",[22,23,28],"pre",{"className":24,"code":25,"language":26,"meta":27,"style":27},"language-ts shiki shiki-themes github-dark","text(source: string | PropRef, opts: {\n    font?: string\n    size?: number\n    align?: 'left' | 'center' | 'right'\n    position?: readonly [number, number]\n    tracking?: number\n    typography?: boolean | readonly TypographyField[]\n    \u002F** Add `.distance(uv)` \u002F `.nearest(uv)`: signed distance, nearest outline point, letter index. *\u002F\n    distance?: boolean\n    \u002F** Add `.letters(i)`: each letter's centre and half size (true = 64 slots, or a count up to 256). *\u002F\n    letters?: boolean | number\n} = {}): TextInput\n","ts","",[17,29,30,49,55,67,90,101,111,127,134,145,151,165],{"__ignoreMap":27},[31,32,35,38,42,46],"span",{"class":33,"line":34},"line",1,[31,36,5],{"class":37},"svObZ",[31,39,41],{"class":40},"s95oV","(source: string ",[31,43,45],{"class":44},"snl16","|",[31,47,48],{"class":40}," PropRef, opts: {\n",[31,50,52],{"class":33,"line":51},2,[31,53,54],{"class":40},"    font?: string\n",[31,56,58,61,64],{"class":33,"line":57},3,[31,59,60],{"class":40},"    size",[31,62,63],{"class":44},"?:",[31,65,66],{"class":40}," number\n",[31,68,70,73,75,79,82,85,87],{"class":33,"line":69},4,[31,71,72],{"class":40},"    align",[31,74,63],{"class":44},[31,76,78],{"class":77},"sU2Wk"," 'left'",[31,80,81],{"class":44}," |",[31,83,84],{"class":77}," 'center'",[31,86,81],{"class":44},[31,88,89],{"class":77}," 'right'\n",[31,91,93,96,98],{"class":33,"line":92},5,[31,94,95],{"class":40},"    position",[31,97,63],{"class":44},[31,99,100],{"class":40}," readonly [number, number]\n",[31,102,104,107,109],{"class":33,"line":103},6,[31,105,106],{"class":40},"    tracking",[31,108,63],{"class":44},[31,110,66],{"class":40},[31,112,114,117,119,122,124],{"class":33,"line":113},7,[31,115,116],{"class":40},"    typography",[31,118,63],{"class":44},[31,120,121],{"class":40}," boolean ",[31,123,45],{"class":44},[31,125,126],{"class":40}," readonly TypographyField[]\n",[31,128,130],{"class":33,"line":129},8,[31,131,133],{"class":132},"sAwPA","    \u002F** Add `.distance(uv)` \u002F `.nearest(uv)`: signed distance, nearest outline point, letter index. *\u002F\n",[31,135,137,140,142],{"class":33,"line":136},9,[31,138,139],{"class":40},"    distance",[31,141,63],{"class":44},[31,143,144],{"class":40}," boolean\n",[31,146,148],{"class":33,"line":147},10,[31,149,150],{"class":132},"    \u002F** Add `.letters(i)`: each letter's centre and half size (true = 64 slots, or a count up to 256). *\u002F\n",[31,152,154,157,159,161,163],{"class":33,"line":153},11,[31,155,156],{"class":40},"    letters",[31,158,63],{"class":44},[31,160,121],{"class":40},[31,162,45],{"class":44},[31,164,66],{"class":40},[31,166,168,171,174],{"class":33,"line":167},12,[31,169,170],{"class":40},"} ",[31,172,173],{"class":44},"=",[31,175,176],{"class":40}," {}): TextInput\n",[13,178,179,180,182,183,186],{},"Import ",[17,181,5],{}," from ",[17,184,185],{},"shaders\u002Fstd",".",[13,188,189,192,193,196,197,200],{},[17,190,191],{},"source"," is a string or a string prop. Feed it to other inputs (",[17,194,195],{},"blur(label)"," for a glow), use it as a mask or a reveal target, or as a spawn shape for particles (",[17,198,199],{},"samplePoints(label)",").",[13,202,203,204,207,208,211,212,215,216,219,220,223,224,223,227,223,230,233,234,237,238,240,241,243,244,223,246,233,248,250],{},"By default it carries the Text component's typography: the component gets Font, Weight, Italic, Transform, Size, Letter Spacing, Line Height, Align, Max Width, Center and Rotation controls (the same ones the Text layer has), a bounding box that hugs the ink and scales the font from its corners, and double-click editing of the text prop on the canvas (its panel field is hidden, as on Text, unless the prop sets ",[17,205,206],{},"ui.hidden: false","). ",[17,209,210],{},"typography: [...]"," keeps only some (an ASCII field might want just ",[17,213,214],{},"['fontFamily', 'fontWeight']","); ",[17,217,218],{},"typography: false"," turns them off and draws with ",[17,221,222],{},"font",", ",[17,225,226],{},"size",[17,228,229],{},"align",[17,231,232],{},"position"," and ",[17,235,236],{},"tracking"," as given. With typography on, ",[17,239,222],{}," ('800 Inter'), ",[17,242,226],{}," (font size as a fraction of the canvas height), ",[17,245,229],{},[17,247,232],{},[17,249,236],{}," set the controls' starting values.",[252,253,255],"h2",{"id":254},"parameters","Parameters",[257,258,259,275],"table",{},[260,261,262],"thead",{},[263,264,265,269,272],"tr",{},[266,267,268],"th",{},"Name",[266,270,271],{},"Type",[266,273,274],{},"Notes",[276,277,278,292],"tbody",{},[263,279,280,285,290],{},[281,282,283],"td",{},[17,284,191],{},[281,286,287],{},[17,288,289],{},"string | PropRef",[281,291],{},[263,293,294,299,302],{},[281,295,296],{},[17,297,298],{},"opts",[281,300,301],{},"`{",[281,303],{},[22,305,309],{"className":306,"code":308,"language":5},[307],"language-text","font?: string\nsize?: number\nalign?: 'left' \\| 'center' \\| 'right'\nposition?: readonly [number, number]\ntracking?: number\ntypography?: boolean \\| readonly TypographyField[]\n\u002F** Add `.distance(uv)` \u002F `.nearest(uv)`: signed distance, nearest outline point, letter index. *\u002F\ndistance?: boolean\n\u002F** Add `.letters(i)`: each letter's centre and half size (true = 64 slots, or a count up to 256). *\u002F\nletters?: boolean \\| number\n",[17,310,308],{"__ignoreMap":27},[13,312,313,314,317],{},"}",[17,315,316],{},"| Optional. Default","`. |",[252,319,321],{"id":320},"examples","Examples",[22,323,325],{"className":24,"code":324,"language":26,"meta":27,"style":27},"```ts\n\u002F\u002F An input that feeds another is a const above the definition (an object literal can't\n\u002F\u002F refer to its own keys).\nconst label = text(p('title'), {font: '700 Inter', size: 0.2})\n\u002F\u002F …\ninputs: {label, glow: blur(label, {radius: 30})},\npaint: wgsl`return vec4f(vec3f(1.0, 0.5, 0.2) * (label(uv).a + glow(uv).a * 0.8), 1.0);`,\n",[17,326,327,332,337,342,347,352,357],{"__ignoreMap":27},[31,328,329],{"class":33,"line":34},[31,330,331],{"class":77},"```ts\n",[31,333,334],{"class":33,"line":51},[31,335,336],{"class":77},"\u002F\u002F An input that feeds another is a const above the definition (an object literal can't\n",[31,338,339],{"class":33,"line":57},[31,340,341],{"class":77},"\u002F\u002F refer to its own keys).\n",[31,343,344],{"class":33,"line":69},[31,345,346],{"class":77},"const label = text(p('title'), {font: '700 Inter', size: 0.2})\n",[31,348,349],{"class":33,"line":92},[31,350,351],{"class":77},"\u002F\u002F …\n",[31,353,354],{"class":33,"line":103},[31,355,356],{"class":77},"inputs: {label, glow: blur(label, {radius: 30})},\n",[31,358,359,362,365,368,371,374,376,380,382,385,387,390,393,396,399,402,405,408,411,413,415,418,421,423,426],{"class":33,"line":113},[31,360,361],{"class":77},"paint: wgsl`",[31,363,364],{"class":44},"return",[31,366,367],{"class":37}," vec4f",[31,369,370],{"class":40},"(",[31,372,373],{"class":37},"vec3f",[31,375,370],{"class":40},[31,377,379],{"class":378},"sDLfK","1.0",[31,381,223],{"class":40},[31,383,384],{"class":378},"0.5",[31,386,223],{"class":40},[31,388,389],{"class":378},"0.2",[31,391,392],{"class":40},") ",[31,394,395],{"class":44},"*",[31,397,398],{"class":40}," (",[31,400,401],{"class":37},"label",[31,403,404],{"class":40},"(uv).a ",[31,406,407],{"class":44},"+",[31,409,410],{"class":37}," glow",[31,412,404],{"class":40},[31,414,395],{"class":44},[31,416,417],{"class":378}," 0.8",[31,419,420],{"class":40},"), ",[31,422,379],{"class":378},[31,424,425],{"class":40},");",[31,427,428],{"class":77},"`,\n",[13,430,431],{},"Shape outputs, for effects that grow from, outline or react per letter:",[433,434,435,482],"ul",{},[436,437,438,441,442,233,445,448,449,452,453,456,457,460,461,464,465,468,469,472,473,233,475,477,478,481],"li",{},[17,439,440],{},"distance: true"," adds ",[17,443,444],{},"label.distance(uv)",[17,446,447],{},"label.nearest(uv)",". Both return a ",[17,450,451],{},"vec4f"," of\n(signed distance to the glyph outlines in canvas pixels, negative inside; the nearest outline\npoint in uv as ",[17,454,455],{},".yz","; the index of the letter that point belongs to as ",[17,458,459],{},".w",", -1 with no text).\n",[17,462,463],{},"distance"," blends smoothly between field texels: use its ",[17,466,467],{},".x"," for halos, outlines, growth\nfronts. ",[17,470,471],{},"nearest"," reads one texel exactly, never mixing two strokes: use its ",[17,474,455],{},[17,476,459],{},"\n(",[17,479,480],{},"length((uv - n.yz) * viewport)"," is the exact distance anywhere). The field is rebuilt on the\nGPU only when the text changes, so it costs nothing while the text holds still.",[436,483,484,487,488,491,492,495,496,499,500,503],{},[17,485,486],{},"letters: true"," (or a count, up to 256; default 64) adds ",[17,489,490],{},"label.letters(i)",": letter i in\nreading order, spaces skipped, as (centre in uv ",[17,493,494],{},".xy",", half width and half height in canvas\npixels ",[17,497,498],{},".zw",", measured in the text's own frame; a rotated text's letters turn with it).\nSlots past the last letter have ",[17,501,502],{},".z"," = -1.",[22,505,508],{"className":506,"code":507,"language":5},[307],"\n```ts\nconst word = text(p('label'), {distance: true, letters: true})\n\u002F\u002F …\ninputs: {word},\npaint: wgsl`\n  let f = word.distance(uv);\n  let halo = exp(-max(f.x, 0.0) \u002F 40.0);                 \u002F\u002F glow falling off outside the glyphs\n  let n = word.nearest(uv);\n  let box = word.letters(i32(n.w));                       \u002F\u002F the letter this pixel belongs to\n  let pulse = 0.5 + 0.5 * sin(time * 3.0 - n.w * 0.6);    \u002F\u002F a wave running letter to letter\n  return vec4f(vec3f(halo * pulse), 1.0);\n`,\n",[17,509,510],{"__ignoreMap":27},"```ts\nconst word = text(p('label'), {distance: true, letters: true})\n\u002F\u002F …\ninputs: {word},\npaint: wgsl`\n  let f = word.distance(uv);\n  let halo = exp(-max(f.x, 0.0) \u002F 40.0);                 \u002F\u002F glow falling off outside the glyphs\n  let n = word.nearest(uv);\n  let box = word.letters(i32(n.w));                       \u002F\u002F the letter this pixel belongs to\n  let pulse = 0.5 + 0.5 * sin(time * 3.0 - n.w * 0.6);    \u002F\u002F a wave running letter to letter\n  return vec4f(vec3f(halo * pulse), 1.0);\n`,\n",[512,513,514],"style",{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}",{"title":27,"searchDepth":51,"depth":51,"links":516},[517,518],{"id":254,"depth":51,"text":255},{"id":320,"depth":51,"text":321},"inputs.text","inputs-text","Text",false,"Text as a field: `label(uv).a` is the coverage (white glyphs, anti-aliased).",null,"md","inputs","Inputs","function",{},true,"\u002Fdocs\u002Fprimitives\u002Finputs-text\u002Ftext",{"title":5,"description":523},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Finputs\u002Ftext.ts#L95","docs\u002Fprimitives\u002F45.inputs-text\u002F2.text","dSGyKeU4jj741wi6S56TuUVqL5PhCTV696-a2NkZEt4",{"stars":537},6080,[539,543,547,551,555,559,563,567,571,575,579,583,587,591,595,599,603,608,612,616,620,624],{"path":540,"title":541,"description":542,"category":17},"\u002Fdocs\u002Fguide","Getting started","Shaders is a desktop app where your AI agent designs interactive effects on an infinite canvas, and you shape them by hand.",{"path":544,"title":545,"description":546,"category":17},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":548,"title":549,"description":550,"category":17},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":552,"title":553,"description":554,"category":17},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":556,"title":557,"description":558,"category":17},"\u002Fdocs\u002Fguide\u002Fprops-reactivity","Props and reactivity","Bind props to your framework's state so effects update when it changes, and animate props with an animation library.",{"path":560,"title":561,"description":562,"category":17},"\u002Fdocs\u002Fguide\u002Fanimation","Animating a shader","Tween a shader's props with Motion, GSAP or anything else that animates a number.",{"path":564,"title":565,"description":566,"category":17},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":568,"title":569,"description":570,"category":17},"\u002Fdocs\u002Fguide\u002Flayout-positioning","Layout and positioning","Size and place a shader in your page with CSS, as a background, a fill, or an inline block.",{"path":572,"title":573,"description":574,"category":17},"\u002Fdocs\u002Fguide\u002Fsizing-and-units","Sizing and units","Size and place layers in CSS units (px, %, vw, rem, and canvas units) that stay correct as the canvas and window resize.",{"path":576,"title":577,"description":578,"category":17},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":580,"title":581,"description":582,"category":17},"\u002Fdocs\u002Fguide\u002Fshape-effects","Shape effects","Pick the 2D, 3D or custom SVG shape that Glass, Neon, Emboss and other shape effects draw inside.",{"path":584,"title":585,"description":586,"category":17},"\u002Fdocs\u002Fguide\u002Fcolor-space","Color space","Match colors to your design tool with the output color space, and keep bright layers from clipping with tone mapping.",{"path":588,"title":589,"description":590,"category":17},"\u002Fdocs\u002Fguide\u002Fhooks-events","Hooks and events","Run code when an effect is ready to show, and show a fallback when the GPU can't run it.",{"path":592,"title":593,"description":594,"category":17},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":596,"title":597,"description":598,"category":17},"\u002Fdocs\u002Fguide\u002Fcustom-shaders","Custom components","Write your own component in TypeScript, use it like any component in the library, and write WGSL by hand when you need to.",{"path":600,"title":601,"description":602,"category":17},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":604,"title":605,"description":606,"category":607},"\u002Fdocs\u002Fguide\u002Fmcp","Working with your agent","The Shaders MCP connects your AI agent to the desktop app, so it can design shaders on your canvas and install them in your project.","workflows",{"path":609,"title":610,"description":611,"category":607},"\u002Fdocs\u002Fguide\u002Fcli","Working with the CLI","The Shaders CLI installs shaders from your projects and the Pro library into your codebase as component files, and keeps them in sync as you keep designing.",{"path":613,"title":614,"description":615,"category":607},"\u002Fdocs\u002Fguide\u002Fframeworks","Supported frameworks","Shaders runs in any web project that renders in a browser with WebGPU, with components for React, Vue, Svelte and Solid and a JavaScript API for everything else.",{"path":617,"title":618,"description":619,"category":17},"\u002Fdocs\u002Fguide\u002Fagent-skill","Agent skill for the engine","Teach your coding agent to write Shaders code with the open-source engine, for when it's working in your codebase instead of on the canvas.",{"path":621,"title":622,"description":623,"category":17},"\u002Fdocs\u002Fguide\u002Fvideo-rendering","Rendering to video","Render a shader effect to video frame by frame, from Remotion, Hyperframes or your own headless Chrome script.",{"path":625,"title":626,"description":627,"category":17},"\u002Fdocs\u002Fguide\u002Fssr","Server rendering","Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",1796051186171,"06e02370-81a6-4d74-9931-661d71414be1"]