127+ Primitives

Dot Text Hero

Text

Interactive headline hero featuring HTML5 canvas text rasterization into hexagonal-packed dots with cursor repulsion, spring-back physics, and twinkling.

Interactive CanvasHooke's LawA11y ReadyHigh DPI
/r/dot-text-hero.json

Installation

Install directly into your project using the shadcn CLI or copy the source code manually.

Requires:framer-motionclsxtailwind-merge
$npx shadcn@latest add "https://boseui.site/r/dot-text-hero.json"

Props

TypeScript props supported by <DotTextHero />.

14 props
PropTypeDefaultDescription
linesstring[]["Cosign", "Awards"]Array of headline text lines rasterized into the interactive dot matrix.
colorsstring[]["#ffffff", "#e5e5e5", "#bdbdbd", "#8a8a8a", "#5c5c5c"]Color palette randomly assigned to dots and cycled during twinkling.
dotSizenumber14Maximum dot diameter in CSS pixels, automatically clamped for small screens.
repelRadiusnumber80Cursor proximity radius in pixels where repulsion physics begins.
repelStrengthnumber5Peak repulsion velocity force applied to dots near the cursor.
springStiffnessnumber0.08Hooke's Law spring return factor restoring dots to their home anchors.
dampingnumber0.82Velocity friction damping coefficient preventing endless oscillation.
twinkleIntervalnumber80Interval in milliseconds between random dot re-colorings. 0 disables twinkling.
brandNamestring"cosign"Brand title rendered in the top navigation bar.
badgeTextReactNode"Cosigning is open"Status badge text displayed with an optional glowing pulse indicator.
descriptionReactNode...Supporting descriptive text rendered beneath the dot matrix headline.
primaryCtaDotTextHeroCta{ label: "Nominate someone", href: "#nominate" }Primary action button configuration with label, href, or onClick handler.
secondaryCtaDotTextHeroCta{ label: "Cosign now", href: "#cosign" }Secondary outline button configuration with label, href, or onClick handler.
showNavbooleantrueWhether to render the top navigation bar with brand, links, and action button.

Key Features

  • Offscreen canvas text rasterization dynamically packed into high-density hexagonal dot fields.
  • Real-time inverse-square mouse repulsion with Hooke's Law spring restoration and velocity damping.
  • Staggered entrance delays and subtle twinkle color cycling for a living, breathing headline.
  • Dual-mode API: use as a complete turnkey hero section or embed the standalone DotTextCanvas anywhere.

Keyboard & Accessibility

  • Provides hidden semantic h1 heading with the full text content for screen readers while marking the canvas aria-hidden.
  • Fully respects prefers-reduced-motion by bypassing entrance delays and disabling physics repulsion and twinkling.
  • Includes keyboard-navigable links and semantic button actions with clear focus indicators.