Documentation

  • 312 sections
  • Solid
  • Tailwind or StyleX

Thumbnail

A picture that is a link. It rests sunk under a Bayer veil and wakes under a pointer: the picture scales up a touch inside its frame as the veil dissolves, and the frame keeps its ratio (phi unless you pick one). The picture's words name the link.

src
Typestring: the picture, cover-fit to the frame Defaultrequired
alt
Typestring: the picture's words and the link's name Defaultrequired
href
Typestring: where the link goes Defaultrequired
ratio
Typestring: the frame's width over its height, any CSS aspect-ratio Default"1.618"
veilCell
Typenumber: the Bayer veil's cell in CSS px Default4
class
Typestring: the link's classes; every other link attribute reaches it too Defaultundefined
Add it to your project
One line copies DitherThumbnail and every kit file they need into your project, in the styling system picked in the header.
curl -fsSL https://dither-ui.com/add/dither-add.mjs | node --input-type=module - add DitherThumbnail

Video player

A native video under dither chrome: play, a dithered scrubber that really seeks, a volume slider, playback speed, mute, fullscreen, and player keyboard (Space, arrows, M, F). Without a source it shows an honest empty face instead of a broken box.

src
Typestring: no src renders an honest empty face Defaultundefined
poster
Typestring Defaultundefined
label
Typestring: accessible name Default"Video"
color
TypePixelColor: scrubber and volume hue Default"blue"
class
Typestring Defaultnone
keyboard
TypeSpace/K play, ←→ seek 5s, ↑↓ volume, M mute, F fullscreen Defaultnone
Add it to your project
One line copies DitherVideoPlayer and every kit file they need into your project, in the styling system picked in the header.
curl -fsSL https://dither-ui.com/add/dither-add.mjs | node --input-type=module - add DitherVideoPlayer

Bracket

A knockout bracket: winners carry the accent, losers strike through, connector rails bridge the rounds. This one is interactive: pick every winner and the final fills itself.

rounds
Type{ a, b, winner? }[][]: columns left to right Defaultrequired
color
TypePixelColor: winner accent Default"green"
interactive
Typeboolean: click a side to pick Defaultfalse
class
Typestring Defaultnone
onPick
Type(round, match, side): consumer advances the data Defaultnone
Add it to your project
One line copies DitherBracket and every kit file they need into your project, in the styling system picked in the header.
curl -fsSL https://dither-ui.com/add/dither-add.mjs | node --input-type=module - add DitherBracket

Schedule

A day timeline: events sit proportionally on the hour rail, each with its swatch rail, and the red now line slides as the day moves. Drag the hour to move time.

events
Type{ start, end, label, color? }[]: fractional hours Defaultrequired
from / to
Typenumber: day window Default8 / 18
now
Typenumber: draws the now line; omit to hide Defaultundefined
class
Typestring Defaultnone
Add it to your project
One line copies DitherSchedule and every kit file they need into your project, in the styling system picked in the header.
curl -fsSL https://dither-ui.com/add/dither-add.mjs | node --input-type=module - add DitherSchedule

World (3D)

A 3D model viewer in the house raster: VRML, X3D, glTF / GLB, OBJ with its MTL, STL, PLY, OFF and Gaussian splats, by URL or inline, drawn on the CPU or through WebGL for big meshes. Files bring their own materials, lights and animations, played on the kit clock; any kit surface can skin the model (the aurora below), and any model comes apart along its seams and builds itself back. Drag to orbit.

A model's own animation and a build share one clock. This rocket is a VRML file: its flame flickers by its own TimeSensor, it climbs off the pad, and at the top the file swells a fireball while the page blows its pieces apart with scatter.

Gaussian splats print too: a capture is a cloud of soft ellipsoids, each laid on the cells as its footprint, near to far until a cell is opaque, and its colour and light go through the same dither. This one is our mascot, grown from its cell table into a body of splats with three electrons ringing it. Give it a .splat file or the .ply a trained capture writes.

src
Typestring: URL of .wrl (VRML97 / 1.0 / X3D classic), .x3d, .gltf / .glb (+ .bin), .obj (+ .mtl), .stl, .ply, .off, or a Gaussian capture (.splat, a trained .ply) Defaultundefined
source
Typestring: inline model text; wins over src Defaultundefined
format
Type"auto" | "vrml" | "x3d" | "gltf" | "obj" | "stl" | "ply" | "off" Default"auto"
up
Type"auto" | "y" | "z" | "-y": the file's up axis (STL defaults to z, a capture to -y) Default"auto"
engine
Type"auto" | "cpu" | "gpu": the CPU engine is byte-exact everywhere, the GPU (WebGL) engine rasterizes big meshes; auto picks the GPU above ~40k triangles Default"auto"
color
TypePixelColor: the dither fill Default"blue"
colors
TypePixelColor[]: a toon ramp, dark to light; lighting picks the band, the Bayer cell dithers between bands Defaultundefined
dither
Typenumber: ramp mode, 0 smooth → 1 banded Default1
material
Typeboolean: the file's own colours (materials, face and vertex colours) Defaultfalse
wire
Typeboolean: polygon outlines, hidden lines removed Defaultfalse
shader
Typestring: a GLSL material over the finished target. mainMaterial(out vec4, in vec2) reads dk_shade, dk_depth, dk_covered and dk_color per cell and returns rgb + the shade the Bayer cell thresholds (WebGL) Defaultundefined
channels
TypeChannelInput[]: kit surfaces (pulled at the same clock time), canvases, images or videos; the first is the model's skin through its texture coordinates, a shader reads them as iChannel0..3 at dk_uv(p) Defaultundefined
grain / grainScale
Typenumber: fbm grain over the model's own space, and its frequency Default0 / 4
bloom
Type"off" | "low" | "high" | "aura" | config | seed: the glow layer Default"off"
animate / time
Typeboolean / number: play the file's animations (VRML ROUTEs, glTF) on the clock, or pin a moment Defaulttrue / undefined
seed
Typenumber: dither matrix, grain + the sample world Defaultundefined
cell
Typenumber: backing cell in CSS px Default3
autoRotate
Typenumber: degrees per second, 0 holds Default12
yaw / pitch / zoom
Typenumber: the pose; unset, the file's Viewpoint decides Default30 / 20 / 1
fov
Typenumber: vertical field of view, degrees Default40
shade
Typenumber: alpha of unlit cells inside the silhouette Default0.18
fog
Typenumber: depth fade of the lighting Default0.3
interactive
Typeboolean: drag or arrow keys orbit Defaulttrue
build
Typenumber: the model as a build, 0-1; its separate pieces rise from a dotted wire cage bottom to top, each flying in hot until it lands Default1
scatter
Typenumber: the pieces blown apart and turned, 0 together → 1 apart Default0
heat
TypePixelColor: the colour a piece glows in while it flies in Default"orange"
nudge
Typeboolean: pieces under the pointer lean away from it, then settle Defaultfalse
label
Typestring: accessible name Default"3D model"
dpr
Typenumber Defaultnone
frameRate
Typenumber: stop-motion cadence in fps (0 = smooth) Default0
paused / renderMode
Typeboolean / "live" | "static" Defaultfalse / "live"
class
Typestring Defaultnone
ref
Type(api: DitherWorldApi) => void Defaultnone
Add it to your project
One line copies DitherAurora, DitherWorld, DitherButton and every kit file they need into your project, in the styling system picked in the header.
curl -fsSL https://dither-ui.com/add/dither-add.mjs | node --input-type=module - add DitherAurora DitherWorld DitherButton

Shader (GLSL)

A fragment shader in the house raster: Shadertoy-style mainImage or a raw main, by URL or inline, run on the GPU at the cell resolution and dithered on the way back, one bit per channel or one tint. iTime is the kit clock, so it seeks and renders to video, and any kit surface can feed it as iChannel0..3. Below, an aurora through a CRT.

src
Typestring: URL of a .frag / .glsl file Defaultundefined
source
Typestring: inline GLSL (Shadertoy mainImage or a raw main); wins over src Defaultundefined
channels
Type(surface | component | canvas | image | video)[]: bound as iChannel0..3; a kit surface is pulled at the same clock time, so the graph seeks and renders as one Defaultundefined
uniforms
TypeiResolution, iTime, iTimeDelta, iFrame, iMouse, iDate, iColor, iSeed, iChannel0..3 and iChannelResolution, plus time/resolution/mouse and u_time/u_resolution/u_mouse; dk_bayer4(fragCoord) is the kit's Bayer threshold Defaultnone
color
TypePixelColor: the mono tint and iColor Default"blue"
colors
TypePixelColor[]: a palette ramp; luminance picks the band, the Bayer cell dithers between bands Defaultundefined
mono
Typeboolean: 1-bit luminance in color instead of the shader's colours Defaultfalse
dither
Typenumber: 0 smooth → 1 fully quantized Default1
levels
Typenumber: colour levels per channel (2 = eight colours) Default2
shade
Typenumber: in mono, the alpha floor of unlit cells Default0
speed
Typenumber: multiplies iTime Default1
seed
Typenumber: dither matrix + the sample shader Defaultundefined
cell
Typenumber: backing cell in CSS px; the shader runs at this resolution Default3
interactive
Typeboolean: the pointer feeds iMouse Defaulttrue
label
Typestring: accessible name Default"Shader"
dpr
Typenumber Defaultnone
frameRate
Typenumber: stop-motion cadence in fps (0 = smooth) Default0
paused / renderMode
Typeboolean / "live" | "static" Defaultfalse / "live"
class
Typestring Defaultnone
ref
Type(api: DitherShaderApi) => void Defaultnone
Add it to your project
One line copies DitherAurora, DitherShader and every kit file they need into your project, in the styling system picked in the header.
curl -fsSL https://dither-ui.com/add/dither-add.mjs | node --input-type=module - add DitherAurora DitherShader