a1ui
6 new components shipped

ASCII Cloth

A hanging sheet of characters that stretches when dragged, with a word woven into the fabric.

Read agent guide

Demo

Drag a character to stretch the cloth, then release it to settle. Press Enter or Space to grab or release the center. While grabbed, use arrow keys to pull the cloth. Escape releases it. Motion stops while paused or when reduced motion is enabled.
Grab a character. Pull the fabric. Let go.

Installation

pnpm dlx shadcn@latest add https://ui.arjayby1.xyz/r/ascii-cloth.json

Code

import { AsciiCloth } from "@/components/ui/ascii-cloth";

export function AsciiClothExample() {
  return <AsciiCloth word="STUDIO" cellSize={15} className="h-96" />;
}

API reference

PropTypeDefaultPurpose
wordstring"A1 UI"Text woven into the middle row of the sheet.
cellSizenumber15Approximate character spacing in pixels, clamped to 10–24.
interactivebooleantrueEnables pointer and keyboard dragging. False removes the focusable control.
pausedbooleanfalseFreezes the current frame and disables dragging until resumed.
ariaLabelstring"ASCII cloth hanging from two corners"Accessible description of the illustration.
classNamestringNoneOuter layout classes. The default height is 24rem.
styleCSSPropertiesNoneSet height, text color, or a loaded monospace font.

The woven word is limited to 24 printable ASCII characters on one row. Longer words are clipped again if the sheet is too narrow. The word shares the cloth's character grid, so it bends and stretches with the other characters.

The default accessible label includes the woven word. Pass ariaLabel to provide a different description.

Drag a character to pull the sheet, then release it to watch the spring mesh settle. The top corners stay fixed. For keyboard use, focus the cloth and press Enter or Space to grab the center. Arrow keys pull it one cell at a time. Press Enter, Space, or Escape to release it.

Reduced motion displays a static sheet and disables dragging. The simulation also stops when the component is offscreen, in an inert preview, or in a hidden tab. Set interactive={false} for decorative use.

The component uses Canvas 2D, ResizeObserver, and IntersectionObserver. It inherits text color and the monospace font, with an accessible label in server-rendered HTML. Canvas size and character count are bounded. It has no image assets or graphics library dependency.