uibrik

On This Page

Preview

Customize

Offset96px
Inset18px
Curve softness0.50
Bend room8px
Section gap8px
Subsection gap0px
Max subsections5
Row height32px
Line width2.0px
Dot size8px

Usage

import { OnThisPage } from "@/components/uibrik/on-this-page/on-this-page";

<OnThisPage sections={sections} />

Installation

npx shadcn@latest add https://uibrik.com/r/on-this-page.json
Adds the files to components/uibrik/on-this-page and installs @tabler/icons-react and motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/on-this-page.

Props

OnThisPage
label
Type string
"On this page"
Heading above the list.
offset
Type number
96
Distance from the top of the scroller where a section counts as current.
inset
Type number
18
How far in the subsection line sits from the main line.
curve
Type number
0.5
Softness of the bend between the two lines. 0.5 is the classic S; lower is tighter.
bendRoom
Type number
8
Extra space above a group's first subsection, giving the bend more room.
sectionGap
Type number
8
Extra space above each new section.
subsectionGap
Type number
0
Space between subsections. Negative values tighten them past the row height.
maxSubsections
Type number
5
Most subsections shown at once for one section; the rest sit behind a More above or More below row and slide in as you go. 0 shows all.
rowHeight
Type number
32
Height of one row.
lineWidth
Type number
2
Thickness of the rail.
dotSize
Type number
8
Diameter of the dot.
sectionsrequired
Type { id: string; title: string; children?: { id: string; title: string }[] }[]
–
Sections to list, each with optional subsections one level deep. Each id is the id of an element on the page.
container
Type RefObject<HTMLElement | null>
–
Scrolling element to follow. Defaults to the window.
className
Type string
–
Classes for the wrapper.