Detent web components
By Shane Logsdon

Media & effects

Glitch Text

Implemented

Cybernetic glitch typography with 5 distinct kinetic animation modes

detent-glitch-text

Port status
Catalog status
implemented
Origin
upstream
Phase
4
Wave
phase-4-canvas
Group
Media & effects

5.9 KB gzip for the class module

Variants

Demo copy, not a dataset. The line in the preview above cycles continuously, as does the first line here (the VHS button switches it), the second and third glitch on hover, and the last bursts on click. Every string is real text that a screen reader reads once; the split, slice, ghost and scramble layers are aria-hidden decoration. With prefers-reduced-motion: reduce the plain text stays and nothing animates.

Show the VHS variant

Recorded states

  • reduced motion recorded state; no setter

Usage

Import

import '/components/glitch-text/define.js';

// or register it yourself
import { DetentGlitchText } from '/components/glitch-text/glitch-text.js';

Attributes

  • color1
  • color2
  • duration
  • green-color
  • intensity
  • purple-color
  • repeat-delay
  • text
  • trigger
  • variant

Properties

  • as

Slots

No slots are recorded for this component.

Events

No events are recorded for this component.

Example

Runnable example: site/examples/glitch-text.ts. The snippet below is generated from the catalogued attributes.

<detent-glitch-text
  color1="#00e571"
  color2="#8b00ff"
  duration="0.5"
  green-color
  intensity="medium"
  purple-color
  repeat-delay="2.5"
  text
  trigger="continuous"
  variant="rgb-split"
></detent-glitch-text>

Property-only values

const element = document.querySelector('detent-glitch-text');
if (element !== null) {
  // as: keyof JSX.IntrinsicElements
  element.as = 'span';
}

Source

The pinned upstream source for this row:

  • src/components/ui/GlitchText.tsx sha256 16ddcb3aff4c…

Native files

The native module and its artifacts:

  • src/components/glitch-text/glitch-text.ts
  • src/components/glitch-text/styles.css
  • src/components/glitch-text/define.ts
  • docs/components/glitch-text.md
  • site/examples/glitch-text.ts
  • tests/browser/glitch-text.spec.ts
  • evidence/components/glitch-text.md

API

Boolean attributes follow HTML presence semantics: present means true, absent means false, and disabled="false" still means disabled.

Attributes

Attributes
AttributePropertyTypeDefaultNotes
color1color1string'#00e571'Kebab-case attribute; camelCase property.
color2color2string'#8b00ff'Kebab-case attribute; camelCase property.
durationdurationnumber0.5Kebab-case attribute; camelCase property.
green-color———Recorded in the catalog as an attribute.
intensityintensity'low' | 'medium' | 'high''medium'Kebab-case attribute; camelCase property.
purple-color———Recorded in the catalog as an attribute.
repeat-delayrepeatDelaynumber2.5Kebab-case attribute; camelCase property.
texttextstring—Kebab-case attribute; camelCase property.
triggertrigger'continuous' | 'hover' | 'click''continuous'Kebab-case attribute; camelCase property.
variantvariant'rgb-split' | 'slice' | 'vhs' | 'scramble' | 'pulse''rgb-split'Kebab-case attribute; camelCase property.

Properties

Properties
PropertyTypeDefaultNotes
askeyof JSX.IntrinsicElements'span'Property-only: assign from script; not accepted as an attribute.

Events

No custom events are recorded for this component.

Slots

No slots are recorded for this component.

CSS customisation

  • `className` prop is replaced by documented CSS parts/custom properties; no Tailwind in consumers.
  • Framer Motion springs/AnimatePresence ported to CSS transitions, WAAPI or the shared rAF spring helper.
  • React state/hooks replaced by element-owned state with pre-upgrade property preservation.
  • The scramble variant keeps the real text in the accessible layer and paints glyph noise in an aria-hidden layer; the source replaced the primary text, so a screen reader read glyph soup (PC-12.6 correction).
  • Decorative layers rest at opacity 0 instead of stacking invisible identical copies of the text; the resting appearance is identical and no duplicate text is painted.
  • as is a documented allow-list that only changes the inner text element tag (a custom element cannot change its own tag); unsupported values fall back to span with a warning instead of throwing.
  • duration and repeat-delay stay in seconds and reject non-finite or negative input with the documented default (PC-3.4).
  • The scramble alphabet is the pinned GLYPH_CHARS driven by a seeded sequence so the decode is reproducible.
  • Derived state and variant are published as root[data-motion] and root[data-variant].
  • No keyboard trigger is invented for hover or click: the text is complete and readable without the effect, which the docs keyboard table states explicitly.

What it does

Cybernetic glitch typography with five modes (rgb-split, slice, vhs, scramble, pulse), three trigger modes (continuous, hover, click) and three intensity tiers. The caller's text is always real, unbroken, readable text.

Upstream behaviour
  • 5 distinct visual glitch modes: 'rgb-split', 'slice', 'vhs', 'scramble', and 'pulse'
  • Interactive trigger options: 'continuous' periodic looping, on 'hover', or interactive 'click' burst
  • Dual chromatic color customization (color1/color2, with backward-compatible greenColor/purpleColor)
  • Calibrated multi-tiered intensity scaling: 'low', 'medium', and 'high'
  • Screen-reader safe: rendered as unbroken native text with aria-hidden on decorative duplicate slices
  • Full prefers-reduced-motion compliance freezing all displacements into clean resting text
  • Polymorphic rendering via the 'as' prop ('span', 'h1', 'h2', 'p', etc.) with full ref forwarding
Differences from upstream
  • `className` prop is replaced by documented CSS parts/custom properties; no Tailwind in consumers.
  • Framer Motion springs/AnimatePresence ported to CSS transitions, WAAPI or the shared rAF spring helper.
  • React state/hooks replaced by element-owned state with pre-upgrade property preservation.
  • The scramble variant keeps the real text in the accessible layer and paints glyph noise in an aria-hidden layer; the source replaced the primary text, so a screen reader read glyph soup (PC-12.6 correction).
  • Decorative layers rest at opacity 0 instead of stacking invisible identical copies of the text; the resting appearance is identical and no duplicate text is painted.
  • as is a documented allow-list that only changes the inner text element tag (a custom element cannot change its own tag); unsupported values fall back to span with a warning instead of throwing.
  • duration and repeat-delay stay in seconds and reject non-finite or negative input with the documented default (PC-3.4).
  • The scramble alphabet is the pinned GLYPH_CHARS driven by a seeded sequence so the decode is reproducible.
  • Derived state and variant are published as root[data-motion] and root[data-variant].
  • No keyboard trigger is invented for hover or click: the text is complete and readable without the effect, which the docs keyboard table states explicitly.
Previous: Glass Navbar Next: Glyph Matrix

Docs

Components

Project