LibraryEffects
InteractiveDotText
Any text drawn as a field of dots that react to the pointer.
InteractiveDotText
Status: internal
Package path: packages/effects/src/interactive-dot-text/
Import: @ziteox/effects/interactive-dot-text
Renders a line of text as dots. Dots near the pointer push away and switch to the highlight colour, then ease back when the pointer moves on. The text scales to the width of its container, whatever the string. Hover the previews with a mouse to try it.
Preview
Usage
import { InteractiveDotText } from "@ziteox/effects/interactive-dot-text";
export function Signature() {
return <InteractiveDotText text="Hello" />;
}By default it uses the surrounding font and text colour. Set them explicitly when needed:
<InteractiveDotText
text="Launch"
fontFamily='"Space Grotesk Variable", sans-serif'
color="#0B0E0F"
highlightColor="#21AB70"
/>Example preset: ziteox.com
The large wordmark at the bottom of ziteox.com: faded top to bottom, at 40% opacity, with muted greens. It is an example, not the default.
<InteractiveDotText
text="ZITEOX"
fontFamily='"Space Grotesk Variable", sans-serif'
letterSpacing={-0.02}
color="#F1F0EB"
highlightColor="#2A9E6E"
highlightColorAlt="#1B7350"
fade
opacity={0.4}
decorative
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | required | The text to draw, one line |
fontFamily | string | inherited | Font stack; load the font in your app |
fontWeight | number | 700 | Font weight |
letterSpacing | number | 0 | Letter spacing in em |
color | string | --zx-dot-text-color, then the inherited text colour | Dot and glyph colour |
highlightColor | string | --zx-dot-text-highlight, then #3BEA9C | Colour of dots the pointer disturbs |
highlightColorAlt | string | --zx-dot-text-highlight-alt, then highlightColor | Second highlight colour, mixed in at random |
fade | boolean | false | Fade from solid at the top to faint at the bottom |
opacity | number | 1 | Opacity of the whole element |
density | number | 1 | Dot density multiplier |
reach | number | 0.3 | Pointer reach as a multiple of the rendered font size |
decorative | boolean | false | Hide from assistive tech; otherwise the text is its accessible name |
className / style | On the wrapper |
Behaviour
- A static SVG of the text renders first (server-safe); on devices with a mouse it switches to the dot canvas.
- Touch devices and
prefers-reduced-motion: reducekeep the static text. - The canvas animates only while the text is on screen.
- Colours set through CSS variables are re-read while it runs, so a theme switch applies without a remount.