Modus UI

Contour Stream

Web (React)

A sentence in italic serif running around the contour of an SVG mark, drawn on canvas.

A mark's contour sampled as one path, with an italic serif sentence running its full length in your theme's ink. It defaults to a rounded square. Hover to speed it up, click to shove the letters outward. It fills its positioned parent, re-reads the theme when the mode or palette changes, pauses when off screen and renders a still frame when the user prefers reduced motion.

Modus / Contour Stream

Installation

CLI

npx @modus-ui/cli add contour-stream

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/contour-stream.tsx.
  3. Paste the code.

Usage

tsx
import { ContourStream } from "@/components/ui/contour-stream";

export default function Example() {
  return (
    <div className="relative h-[500px] w-full overflow-hidden">
      <ContourStream />
    </div>
  );
}

Props

PropTypeDefaultDescription
pathstring"M6 2h12a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4Z"SVG path data (24×24 viewBox) the type follows.
textstring"modusfollowsthecontourandwritesitbackonemoretime"Phrase running along the outline.
scalenumber1Scales the drawing (clamped 0.65–1.5).
opacitynumber1Overall opacity (clamped 0.1–1).
huenumber0Hue rotation in degrees (clamped -180–180).
saturationnumber1Saturation multiplier (clamped 0–2).
brightnessnumber1Brightness multiplier (clamped 0.4–1.8).
inkColorstringTheme ramp (--muted-foreground → --primary)Colour of the type, any CSS colour.
backgroundColorstringhsl(var(--background))Ground colour, any CSS colour.

Comments

  • No comments yet.