skip to content
mpkcn

~/components/section-divider

Section Divider

A terminal-style break between sections: hairlines grow out and a linked label types "EOF about $ cd ../work".

EOF about $ cd ../work

Installation

terminal
npx mpkcn add section-divider
deps:none beyond react· tested with react@19.3.0

Usage

Place it between two sections. The label links to the next section's id.

tsx
import { SectionDivider } from "@/components/mpkcn/section-divider";

export default function Page() {
  return (
    <main>
      <section id="about">…</section>
      <SectionDivider from="about" to="work" className="my-24" />
      <section id="work">…</section>
    </main>
  );
}

When 60% of the divider is visible, the two hairlines grow out from the middle, the label pops in, and EOF about $ cd ../work types itself. When it leaves the viewport it resets, so it plays again on the way back. Clicking the label smooth-scrolls to #work.

Examples

Custom path

A to that starts with ~ or / is shown as is, without ../:

EOF contact $ cd ~

Leave out from to drop the EOF part. href={null} renders plain text instead of a link.

tsx
<SectionDivider to="appendix" href={null} />

Hook into navigation

onNavigate fires after a click, for example to send an analytics event or close a menu.

tsx
<SectionDivider from="work" to="contact" onNavigate={() => track("divider-click")} />

Props

PropTypeDefaultDescription
fromstring—Section you are leaving. Shown dimmed as "EOF {from}". Leave empty to show only the command.
tostring—Section you are going to. Shown as "$ cd ../{to}", or "$ cd {to}" when it starts with "~" or "/".
hrefstring | null"#{to}"Where the label links to. null renders plain text instead of a link.
onNavigate() => void—Called when the label is clicked, after the smooth scroll to an in-page anchor.
typingbooleantrueType the label in once the lines have grown. false shows it at once.
ignoreReducedMotionbooleanfalseAnimate even when the user prefers reduced motion. Only use it behind an explicit action, like a "play anyway" button.
classNamestring—Extra classes for the root element. Vertical spacing is up to you.

Accessibility

  • The label is a regular link with a visible focus ring. Its accessible name is the full command (for example "EOF about $ cd ../work"), read from a visually hidden copy; the typed characters and the cursor are aria-hidden.
  • The hairlines are decorative and hidden from assistive technology.
  • Under prefers-reduced-motion: reduce the label appears with no typing, the lines don't grow, and clicking jumps instead of smooth-scrolling.