Documentation

  • 311 sections
  • Solid
  • Tailwind or StyleX

Quick start

The kit is a folder, not a package. Copy dither-kit/ from the GitHub repo (opens in a new tab), install four small runtime deps and alias it. You already have Solid, and Tailwind if you use it.

  1. Copy the kit folder straight from the repo

    degit grabs just the folder

    npx degit drvova/dither-ui/packages/dither-kit/src src/dither-kit
  2. Install the runtime deps

    you already have Solid, and Tailwind if you use it

    npm i d3-scale d3-shape clsx tailwind-merge
  3. Alias @dither-kit so imports stay clean

    // vite.config.ts
    resolve: { alias: { "@dither-kit": "/src/dither-kit/solid" } }
    
    // tsconfig.json, under compilerOptions
    "paths": { "@dither-kit": ["./src/dither-kit/solid"] }
  4. Use it

    import { AreaChart, Area, DitherButton } from "@dither-kit"

Without Tailwind

The kit brings its own stylesheet, in cascade layers so your styles win. Pick your system in the header and every snippet here, every Studio export and the agent's code.get come out as a scoped stylesheet, CSS Modules or StyleX.

<!-- No Tailwind? One plain stylesheet: the tokens, a base scoped to
     .dither-kit and every class the components use. -->
<link rel="stylesheet" href="https://dither-ui.com/kit/dither-kit.css">

<div class="dither-kit">
  <DitherButton class="cta">Ship</DitherButton>
</div>

The tokens are plain custom properties, so theme from CSS, JS or any vars contract:

import { applyTheme, themeCss } from "@dither-kit"

applyTheme({ accent: "#3f8ff3", radius: "4px" })  // on <html>, returns the undo
themeCss({ background: "#000" }, ".dark")          // a rule for your stylesheet

Prefer to read the source first? Every component lives under dither-kit/ (opens in a new tab). No build step, no black box.

Engine

The parts under every surface, each named once: what it does in one line, and a figure read from the kit's own source.

Matrix
Each cell compares its tone with one rank of a 4×4 threshold matrix and lights when the tone passes it, so a flat fill becomes a pattern of lit and unlit cells. Print screens
16 ranks, 17 tones
Screens
The matrix is Bayer's unless a DitherScreen around a surface picks a printer's line, diagonal, dot or cross; a fill that carries a label keeps Bayer, so its letters hold. Print screens
5 screens
Seeds
One integer seeds the matrix's jitter, the texture, the bloom and the easing, so the same seed draws the same surface every time. Seeds
1 integer
Palette
One table resolves each hue to the fill, line and star colours every surface paints with, and the theme's swatches mirror it. Palette
7 hues
Clock
One clock drives every animation; held at a moment, every surface paints that moment, and the same moment gives the same bytes. Stage
0 frames while held
Wipe
Reveals and page transitions are ordered-dither masks: a cell shows once the sweep passes its rank in an 8×8 matrix, so a wipe has a dithered front, never a soft edge. Dither reveal
64 ranks
World
Model files parse in the page and rasterize on the CPU byte for byte, or on WebGL for big meshes, into the same dither pass. World (3D)
8 formats
Shader
GLSL compiles offscreen at the cell resolution and its pixels are read back and dithered; iTime is the kit's clock, and other surfaces bind as its inputs. Shader (GLSL)
4 inputs

Verification

The kit's claims, measured with its own engine in the browser reading this page: what each one claims, how it is measured and against what, then the reading. CI takes the same readings on every push, and each claim links the test that holds it.

Measured in your browser when this section comes into view.

Same seed, same moment, same bytes
The poster is printed twice at seed 5 and 2.4 s and every byte compared; printed again at 3.4 s, the control must differ. Its test: Same seed, same moment, same bytes (opens in a new tab)
not yet measured
against 0 bytes differ
The same bytes in every engine
The same print is hashed through the kit's FNV-1a and set beside the hash CI recorded running the kit in Node. Its test: The same bytes in every engine (opens in a new tab)
not yet measured
against hash c8364f4f
Every screen prints 17 tones
Each screen's 4×4 thresholds are set against 17 even tone steps by the rule every surface prints with, a cell lighting when the tone passes its threshold, and the lit cells counted. Its test: Every screen prints 17 tones (opens in a new tab)
not yet measured
against step k lights k cells
The 3D engine repeats itself byte for byte
A box read from a VRML file is rasterized twice on the CPU at one view and every byte compared; turned 15°, the control must differ. Its test: The 3D engine repeats itself byte for byte (opens in a new tab)
not yet measured
against 0 bytes differ
A scene scales exactly with its box
A track of container units and percentages is sampled at 0.7 s and resolved in a 320 by 180 box, then in one twice that size. Its test: A scene scales exactly with its box (opens in a new tab)
not yet measured
against every length doubles
A wipe shows one more cell per step
The dissolve's mask is drawn at each of the 64 steps of its 8×8 matrix and its shown cells compared step to step. Its test: A wipe shows one more cell per step (opens in a new tab)
not yet measured
against one more each step
8 model formats read in the page
A triangle written in each format (a Gaussian in the capture's) is parsed by the kit's own readers, here, with nothing fetched. Its test: 8 model formats read in the page (opens in a new tab)
not yet measured
against a triangle or a Gaussian from each
The landing's inks hold their contrast as printed
Bone, muted bone and the ember are printed through the Bayer matrix on the obsidian at full and half tone, and each patch is measured from its pixels in linear light. Its test: The landing's inks hold their contrast as printed (opens in a new tab)
not yet measured
against 4.5:1 full, 3:1 at half

Gradient text

An animated gradient clipped to the text. The colour band drifts across the glyphs forever. Respects reduced motion.

colors
Typestring[] (hex) Default['#358ff3', '#7CFF67', '#358ff3']
speed
Typenumber Default1
class
Typestring Defaultundefined
children
Typetext Defaultnone

Shiny text

A bright highlight sweeps across dim text on a loop: a subtle sheen for headlines and labels.

speed
Typenumber Default1
disabled
Typeboolean Defaultfalse
class
Typestring Defaultundefined
children
Typetext Defaultnone

Glitch text

Two RGB-split copies jitter and clip over the base text for a broken-signal effect. The base stays readable; the glitch layers hide under reduced motion.

text
Typestring Default"GLITCH"
speed
Typenumber Default1
class
Typestring Defaultundefined

Split text

Each character rises and settles on a stagger. Bump replayToken to run it again; the whole word is still one labelled node for screen readers.

text
Typestring Default"Split text"
stagger
Typenumber (ms/char) Default40
duration
Typenumber (ms) Default600
replayToken
Typenumber Default0
class
Typestring Defaultundefined

Rotating text

Cycles through a list of words for a headline that says several things, each sliding out as the next slides in.

texts
Typestring[] Default['Solid', 'canvas', 'dither']
interval
Typenumber (ms) Default2000
class
Typestring Defaultundefined

Count up

Eases a number from from to to when it scrolls into view. Locale-formatted, tabular figures. Reduced motion jumps to the final value.

to
Typenumber Defaultrequired
from
Typenumber Default0
duration
Typenumber (ms) Default1500
decimals
Typenumber Default0
class
Typestring Defaultundefined

Number flow

An odometer for live values: every digit rides a 0-9 column that rolls to the new figure whenever value changes. Count up plays once; this one never stops. Reduced motion snaps.

value
Typenumber Defaultrequired
decimals
Typenumber Default0
duration
Typenumber (ms): roll time per change Default600
class
Typestring Defaultundefined

Text type

A typewriter with a blinking caret: it types each string, pauses, deletes and moves to the next. Reduced motion shows the first line, no typing.

texts
Typestring[] Default['Type this out.', 'Then this.']
typingSpeed
Typenumber (ms) Default60
deletingSpeed
Typenumber (ms) Default35
pause
Typenumber (ms) Default1400
loop
Typeboolean Defaulttrue
cursor
Typeboolean Defaulttrue

Blur text

Words (or characters) blur into focus on a stagger the first time they enter the viewport. Still one labelled node for screen readers.

text
Typestring Default"Blur into focus"
by
Type"words" | "chars" Default"words"
stagger
Typenumber (ms) Default90
duration
Typenumber (ms) Default600

Decrypted text

Scrambled cipher characters resolve left-to-right into the real text when it scrolls into view. Monospace keeps the width steady.

text
Typestring Default"DECRYPTED"
speed
Typenumber Default1
trigger
Type"view" | "hover" Default"view"

Scramble text

Hover to burst-scramble the characters, which then settle back to the real text. Repeatable on every hover.

text
Typestring Default"Hover to scramble"
speed
Typenumber Default1

Shuffle

Characters fly in from scattered offsets and rotations, settling into place on a stagger. Bump replayToken to run it again.

text
Typestring Default"Shuffle in"
stagger
Typenumber (ms) Default55
duration
Typenumber (ms) Default650
replayToken
Typenumber Default0

Falling text

Characters drop in from above with a little overshoot bounce, staggered across the line.

text
Typestring Default"Falling text"
stagger
Typenumber (ms) Default45
duration
Typenumber (ms) Default700
replayToken
Typenumber Default0

Scroll reveal

The words fade and de-blur word-by-word as the block travels up through the viewport. The reveal is tied to scroll position, not a one-shot. Scroll the page.

text
Typestring Defaultrequired
class
Typestring Defaultundefined

Scroll float

Characters float up from an offset as the scroll progress reaches each one: a gentle parallax settle. Scroll the page.

text
Typestring Defaultrequired
amount
Typenumber Default1

Scroll velocity

A seamless marquee band that drifts on its own and speeds up (or reverses) with your scroll velocity, easing back to base speed. Scroll the page.

text
Typestring Default"DITHER · UI · TOOLKIT ·"
baseSpeed
Typenumber (px/s) Default60

Text cursor

The characters of the word trail the pointer inside the box, each lagging a little further behind for a ribbon of type. Move your cursor over the preview.

text
Typestring Default"dither"
class
Typestring Defaultundefined

Text pressure

Characters bulge (scaling up and gaining weight) near the cursor, like the word is being pressed. Move your cursor near the text.

text
Typestring Default"Pressure"
radius
Typenumber (px) Default140
strength
Typenumber Default1

Variable proximity

Each character's weight and opacity ramps with its distance to the pointer. No scaling, so a whole sentence stays put while the cursor lights a path through it.

text
Typestring Defaultrequired
radius
Typenumber (px) Default120

True focus

One word stays sharp while the rest blur, and the focus steps through the phrase on a timer, pulling the eye word by word.

text
Typestring Default"True focus mode"
interval
Typenumber (ms) Default1400
blur
Typenumber (px) Default5

Circular text

Text set around a full circle on an SVG path, rotating forever: a badge or seal. Uses currentColor so it inherits type colour.

text
Typestring Default"DITHER · UI · TOOLKIT ·"
duration
Typenumber (s) Default12
size
Typenumber (px) Default170

Curved loop

Text flows along a wavy SVG path as a seamless loop. The copy length is measured so the scroll wraps without a visible seam.

text
Typestring Default"DITHER UI · CANVAS + BAYER ·"
speed
Typenumber (units/s) Default60

Fuzzy text

An SVG turbulence + displacement filter wobbles the glyph edges into an analog fuzz. Native filters, no canvas. Reduced motion drops the filter.

text
Typestring Default"FUZZY"
intensity
Typenumber Default4

ASCII text

The word is rasterised to an offscreen canvas and mapped onto an ASCII density ramp: an on-brand ASCII render of any string.

text
Typestring Default"DITHER"
cols
Typenumber Default64