Documentation

  • 312 sections
  • Solid
  • Tailwind or StyleX

Box

One element, one job: a typed container whose whole style arrives as class. Swap the tag with as (landmarks for structure, spans for inline flow) and its children never notice.

as
Type"div" | "section" | "span" | "article" | … Default"div"
class
Typestring Defaultnone
Add it to your project
One line copies DitherBox 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 DitherBox

Text

The type scale the whole site speaks: three token tones, four sizes from 11 to 15px, and as for the element. Leading, tracking and weight stay yours in class.

as
Type"p" | "span" | "h3" | "li" | … Default"p"
tone
Type"default" | "muted" | "faint" Default"default"
size
Type"xs" | "sm" | "md" | "lg" (11–15px) Defaultnone
class
Typestring Defaultnone
Add it to your project
One line copies DitherText 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 DitherText

Divider

A hairline rule with real separator semantics. Horizontal renders an hr; vertical lives in flex rows and stretches to their height. Both announce their orientation.

orientation
Type"horizontal" | "vertical" Default"horizontal"
class
Typestring Defaultnone
Add it to your project
One line copies DitherDivider, DitherText 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 DitherDivider DitherText

VisuallyHidden

Content for screen readers only: labels that must exist in the reading order without painting anything. Flip on focusable for the skip-link pattern: Tab reveals it, styled as a chip over the page.

focusable
Typeboolean Defaultfalse
class
Typestring Defaultnone
Add it to your project
One line copies DitherVisuallyHidden 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 DitherVisuallyHidden

Svg

A neutral SVG shell: no imposed stroke language, so the kit's art direction stays inside the components. Decorative by default (aria-hidden); a label promotes it to role="img" with a name.

viewBox
Typestring Defaultnone
label
Typestring (promotes to role=img) Defaultnone
class
Typestring Defaultnone
children
Typecontent Defaultnone
Add it to your project
One line copies DitherSvg 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 DitherSvg

Image

The plain img with the modern loading contract baked in: lazy, async decode, and a required alt (empty string is the explicit decorative choice). For the ordered-dither renderer see Image in Components.

src
Typestring Defaultrequired
alt
Typestring (empty string = decorative) Defaultrequired
loading
Type"lazy" | "eager" Default"lazy"
decoding
Type"async" | "auto" | "sync" Default"async"
class
Typestring Defaultnone
Add it to your project
One line copies DitherImg 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 DitherImg

Spacer

Sized empty space for flex and grid rows, the alternative to magic margins. Two axes, five steps from 4 to 40px, always decorative.

axis
Type"y" | "x" Default"y"
size
Type"xs" | "sm" | "md" | "lg" | "xl" (4–40px) Default"md"
class
Typestring Defaultnone
Add it to your project
One line copies DitherSpacer 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 DitherSpacer

Portal

Portal by name: render children elsewhere in the DOM so popovers and toasts escape overflow: hidden. disabled keeps it in place (the switch for tests and environments where the target does not exist); defer waits for the rest of the render, so the target can come later in the same markup, as it does here.

to
Typestring (selector) Default"body"
disabled
Typeboolean Defaultfalse
defer
Typeboolean (the target may come later in the markup) Defaultfalse
children
Typecontent Defaultnone
Add it to your project
One line copies DitherPortal 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 DitherPortal

Overlay

A full-cover layer in four dim weights. Decorative and click-transparent by default; interactive makes it catch presses (dismissible scrims) and lifts the aria-hidden so its children stay reachable.

dim
Type"none" | "soft" | "medium" | "strong" Default"soft"
interactive
Typeboolean Defaultfalse
class
Typestring Defaultnone
Add it to your project
One line copies DitherOverlay 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 DitherOverlay

Measure

Reports its own box: a plain block that calls onResize with width and height on every change. ResizeObserver only: without it the children still render and it simply stays silent.

onResize
Type({ width, height }) => void Defaulton box change
Add it to your project
One line copies DitherMeasure 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 DitherMeasure

Clipboard

Clipboard behavior around any trigger: the function child gets copied and copy, and a polite live region announces the result. Your trigger keeps its own semantics. This adds the behavior and the announcement.

value
Typestring Defaultrequired
disabled
Typeboolean Defaultfalse
onCopied
Type(value) => void Defaulton success
children
Type(scope: ClipboardScope) => JSX.Element Defaultnone
Add it to your project
One line copies DitherClipboard 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 DitherClipboard

ClickOutside

One outside event when a primary press lands anywhere beyond the wrapped content: capture-phase pointerdown, so nested scroll containers and shadowed children are handled by containment, not by guessing.

enabled
Typeboolean Defaulttrue
class
Typestring Defaultnone
onOutside
Type(event) => void: pointerdown outside Defaultnone
children
Typecontent Defaultnone
Add it to your project
One line copies DitherClickOutside 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 DitherClickOutside

FocusRing

Container-level focus: wraps a control group and rings while anything inside holds focus, so keyboard users see which group is active. The individual control keeps the global :focus-visible floor.

class
Typestring Defaultnone
children
TypeJSX.Element Defaultnone
Add it to your project
One line copies DitherFocusRing 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 DitherFocusRing

FocusScope

The modal focus contract in one component: focus enters on mount, Tab cycles inside the scope, and closing hands focus back to whatever had it. Every dialog in the kit obeys exactly these three rules.

autofocus
Typeboolean Defaulttrue
trapped
Typeboolean Defaulttrue
restoreFocus
Typeboolean Defaulttrue
class
Typestring Defaultnone
Add it to your project
One line copies DitherFocusScope 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 DitherFocusScope

HoverArea

Hover state as function-child data: no refs, no listener bookkeeping. Keyboard focus tracks alongside the pointer so the reveal is the same for everyone.

children
Type({ hovered, focused }) => JSX.Element Defaultnone
Add it to your project
One line copies DitherHoverArea 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 DitherHoverArea

Pressable

A native button (never submits a form by accident) with the house press affordance and the theme's focus ring that looks like a button out of the box: solid ink by default, outline or ghost beside it, and plain for the bare base when you draw every pixel yourself. For the dithered, blooming version see DitherButton.

variant
Type"solid" | "outline" | "ghost" | "plain" Default"solid"
type
Type"button" | "submit" | "reset" Default"button"
disabled
Typeboolean Defaultfalse
class
Typestring Defaultnone
Add it to your project
One line copies DitherPressable 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 DitherPressable

InView

The taxonomy's IntersectionObserver primitive, named for what it does: visibility as function-child state. once latches after the first enter (the lazy-reveal shape this whole page runs on). Degraded engines see content, never an empty box.

rootMargin
Typestring Default"200px"
threshold
Typenumber Default0
once
Typeboolean Defaulttrue
class
Typestring Defaultnone
onEnter
Type() => void Defaultnone
onLeave
Type() => void Defaultnone
children
Type({ inView }) => JSX.Element Defaultnone
Add it to your project
One line copies DitherInView 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 DitherInView

Icon

87 glyphs

The hand-rolled set: 24×24 stroke geometry, currentColor, round caps. One source in icons.ts, no dependencies. Decorative by default; a label names it for screen readers. Unknown names throw instead of rendering an empty box.

name
TypeIconName (glyph list in icons.ts) Defaultrequired
size
Typenumber (px) Default16
label
Typestring (promotes to role=img) Defaultnone
strokeWidth
Typenumber Default2
class
Typestring Defaultnone
Add it to your project
One line copies DitherIcon 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 DitherIcon

IconSet

The same set as <symbol> sheets: mount once and reference glyphs with <use href="#di-icon-Name"> when a screen repeats icons enough to care. Opt-in: DitherIcon never needs it.

use
Typevia <use href="#di-icon-Name"> Defaultnone
Add it to your project
One line copies DitherIconSet 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 DitherIconSet