1 slot open this monthBy the makers of shadcnregistryWe built shadcnregistry. Now we build your product.Book a callCheck availability
1 slot open this monthAI features?We build AI features into your product.Book a callCheck availability
1 slot open this month๐Ÿšจ Slop police๐Ÿšจ Slop police: we clean up vibe-coded apps.Report itReport your app
shadcnregistry
shadcnregistry
RegistryHealthInspect
Terms of ServicePrivacy Policy
  1. Registries
  2. mangacn
  3. Reading Progress

Reading Progress

component

A reading progress bar: a 2px ink baseline with an ink fill-lines bar sitting on it (G7), in whole pixels; the bar shares the baseline's outer edge and grows inward, 4px of solid ink at rest and 6px with a paper speed line through it while the reader scrolls or the value changes. Measures the scroll of a target element (its own scroll, or how far the window has moved through it) or of the window, with requestAnimationFrame, cleaned up on unmount; or takes a controlled value (then the width moves in steps). Positions: fixed to the top or bottom edge of the viewport, or inline in the flow. In manga reading order (data-reading="rtl") it fills from the right. Optional value text ("42 %" or "Page 3 / 8") on paper, never on the lines. role="progressbar" with aria-valuenow/min/max and aria-valuetext. Reduced motion: no motion, the value still updates. Also exports useScrollProgress(target) and the reading line shared by the readers' page counters: the current page is the last page whose top has crossed a line a third of the way down the visible part of the view, under its sticky header (sticky or fixed bars over its top edge are found on their own); page 1 until page 2 crosses that line, the last page once the bottom of the last page is in view. readingArea(el) gives the visible part, readingPage(pages, area) the page, and useReadingPage(count) keeps it up to date for a list: const [page, ref] = useReadingPage(pages.length).

pnpm dlx shadcn@latest add "https://mangacn.romain-sonnet.fr/r/reading-progress.json"
Premium blocks for shadcn/uiShadcnblocks.com ยท AffiliateExplore
  • cn
@components/manga/reading-progress.tsx