Skip to content

    Browse components

    Read Focus

    A paragraph whose words sharpen from dim and blurred to crisp as it scrolls through view.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/read-focus

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/read-focus.json

    Usage

    import { ReadFocus } from "@/components/ui/read-focus";
    
    const box = useRef<HTMLDivElement>(null);
    
    <div ref={box} className="h-96 overflow-y-auto">
      <ReadFocus scrollContainerRef={box} text="Good motion is a quiet language..." />
    </div>

    Props

    PropTypeDefaultDescription
    textstring"Good motion is a quiet language. Every fade and every shift in focus tells the reader where to look next, and when it is done right nobody notices the craft, only the clarity."Paragraph to reveal.
    baseOpacitynumber0.12Opacity of words not revealed yet.
    blurnumber8Blur of unrevealed words, in px.
    softnessnumber6How many words transition at once.
    rotationnumber3Starting tilt in degrees, settles to 0.
    scrollContainerRefReactNode—Ref to the scrolling element. Defaults to the window.
    as"p" | "h2" | "h3" | "div""p"Element to render.
    classNamestring—Extra classes for the root element.