Spoiler dust

Pro

Hidden text and photos in chat and reviews sit under shimmering particle dust that drifts. A tap blows the dust away from the touch point to reveal the content, and tapping again hides it.

Live · keyboard ready

Chloe Nguyen

Planning Sam's birthday

Found the place for Sam's surprise. Don't open this anywhere near him.

The back room holds twenty, and he has never been.

Perfect. How do we get him there without him guessing?

Tell him it's a work dinner. The side door code is , it opens straight into the back room.

And the gift is .

It all starts . I'll keep him busy until then.

0 of 4 revealed

  • Plot points, results, or endings in chat, reviews, and comments that readers should choose to see.
  • Sensitive values shared in a conversation, such as a door code or a surprise, and photos that should not show at a glance.
  • Use scratch-card for a reward reveal that should feel like a game, with progress and a single payoff.
  • Use a password field or a masked value with a show button for credentials in forms.
  • Avoid long passages; a spoiler is for a phrase or a single image, not whole paragraphs.

Installation

Pro source and install commands unlock with a Pro plan.

example.tsx
import { Spoiler, SpoilerDust } from "@/components/arc/spoiler-dust/spoiler-dust"; export function Review() {  return <SpoilerDust>    <p>      Slow first act, then it never lets go. The twist that <Spoiler label="twist">the narrator was the lighthouse keeper all along</Spoiler> reframes every chapter.    </p>  </SpoilerDust>;}

API reference

2 parts. The first is the root.

SpoilerDust

A scope for spoilers in chat, reviews, and comments. Everything marked with Spoiler inside it sits under a fine shimmering dust that drifts and twinkles in place and parts around the pointer like sand. A tap blows the dust away from the touch point: grains fly outward and fade while the hidden words come back in a wave from where the finger landed, and a frosted veil over a photo opens as a soft circle from the same point. Tapping a revealed spoiler settles the dust back over it. Without children it renders a sample conversation with a hidden photo, door code, gift, and time, a revealed count, and a Hide all button.

PropTypeDefaultDescription
childrenReactNode–Your own content with Spoiler elements anywhere inside it. Leave it out to render the sample conversation.
densitynumber1Multiplies how many dust grains cover each spoiler, from about 0.4 to 1.6.
speednumber1Multiplies how fast the dust drifts and twinkles.
pausedbooleanfalseFreezes the drift and twinkle. Reveals, hides, and the pointer still move the dust.
accentstring–Color of your own messages in the sample conversation. Defaults to the accent.
classNamestring–Extra class on the root element.
styleCSSProperties–Inline styles on the root element.

Spoiler

A hidden run of text, or with media a hidden block such as a photo. It must sit inside SpoilerDust, which draws its dust. Text keeps its place in the line, so hiding and revealing never reflows the message.

PropTypeDefaultDescription
childrenReactNode–The hidden content: a few words inline, or a block such as an image when media is set.
revealedboolean–Controlled revealed state. Changing it from outside plays the reveal or hide from the center of the spoiler.
defaultRevealedbooleanfalseInitial state when uncontrolled.
onRevealedChange(revealed: boolean) => void–Called with the new state when someone taps, clicks, or presses Enter or Space on the spoiler.
mediabooleanfalseCovers a block, such as an image, with a frosted veil under the dust instead of hiding words. Give it a size or aspect ratio and a border radius with className.
labelstring"spoiler"What is hidden, used as "Reveal <label>" for the accessible name and in announcements, for example "door code" or "ending".
classNamestring–Extra class on the spoiler element.
styleCSSProperties–Inline styles on the spoiler element.
  • Each spoiler is a toggle button (role="button" with aria-pressed) reached with Tab. Enter or Space reveals it from its center, and pressing again hides it.
  • While hidden, the content is hidden from assistive tech and the button is named "Reveal <label>", so a screen reader never reads the spoiler by accident. Once revealed, the name comes from the content itself, including an image's alt text.
  • A polite live region announces each change, such as "Door code revealed", and changes made together, such as Hide all, as one sentence.
  • Hidden text cannot be selected or copied. The revealed count in the sample is written out, so state never depends on the dust alone.
  • Pointer focus draws no ring; keyboard focus shows Arc's shared focus ring. Keyboard focus tints the spoiler's background, and a focused photo darkens its veil slightly.
  • One canvas over the scope and one rAF loop draw every grain of dust from typed arrays, in a few alpha batches per spoiler. React only renders when a spoiler is toggled.
  • Hidden dust drifts inside each line box and bounces off its edges, and every grain twinkles at its own rate. Grains near the pointer are pushed away and dragged along by its velocity, then spring back with a soft wobble.
  • A reveal travels as a wave from the touch point. Each grain lets go when the wave reaches it and flies straight away from that point with drag, fading as it goes. Words fade and unblur on the same timing, and a photo's frosted veil opens as a soft edged circle the loop writes as a mask each frame.
  • Hiding runs the wave the other way: fresh dust settles in from the tap point outward, each grain sliding a few pixels into place, while the words fade out quickly and the veil closes over the photo in a growing circle.
  • The loop sleeps when nothing is hidden or moving, when the component is off screen, and when the tab is hidden. Reduced motion shows still dust and reveals or hides instantly.
  • Text spoilers wrap with the line and the dust follows every line box, so they work at any width. The canvas resizes with the scope and redraws the dust on resize.
  • The sample conversation uses container queries: bubbles take up to 86 percent of a narrow container and 74 percent of a wide one.
  • Pointer stirring is for mouse and pen; on touch a tap reveals, and vertical swipes still scroll the page.
  • Dust is capped per spoiler by area, and grains are drawn as tiny squares in eight alpha batches, so a busy thread stays well inside a frame.
  • Layout is read once per resize, theme change, or toggle, never per frame. The veil's backdrop blur is static; only its mask changes during a reveal.

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

  • Wrap the whole thread, review list, or comment section in one SpoilerDust, not each message; a single scope shares one canvas and one loop.
  • Give every Spoiler a short label that says what is hidden without spoiling it, such as "ending", "price", or "venue photo".
  • For photos, pass media and size the Spoiler with an aspect ratio and radius; the veil and dust follow its rounded corners.
  • Control revealed from state to build Hide all or Reveal all actions, as the sample conversation does.

The full library index for assistants is at /llms.txt.