skip to content
mpkcn

~/components/prompt-footer

Prompt Footer

A site footer laid out as a shell session: ls prints your link columns, date the copyright and an optional live clock, and the last prompt blinks.

Installation

terminal
npx mpkcn add prompt-footer
deps:none beyond react· tested with react@19.3.0

Usage

A footer that reads like a shell session. ls prints your link columns, date your copyright, and the last prompt waits with a blinking cursor.

tsx
import Link from "next/link";
import { PromptFooter } from "@/components/mpkcn/prompt-footer";

export function Footer() {
  return (
    <PromptFooter
      user="guest"
      host="mysite.dev"
      linkComponent={Link}
      groups={[
        { title: "sections", links: [{ label: "docs", href: "/docs" }, { label: "blog", href: "/blog" }] },
        { title: "elsewhere", links: [{ label: "github", href: "https://github.com/you" }] },
      ]}
      owner="Your Name"
      note="built with Next.js"
    />
  );
}

Links that start with http open in a new tab. Internal links use linkComponent when you pass one (next/link fits), plain <a> otherwise.

Examples

Now block and clock

now prints a few label: value lines as cat now.txt. clock adds a live HH:MM:SS clock on the date line; with timeZone and clockLabel it can show your own local time.

Your own last line

Anything you pass as children replaces the cursor after the last prompt, for example a status or a small input.

guest@mysite.dev:~$ls ~/sections
guest@mysite.dev:~$date
© 2026 Your Name
all systems normal

Props

PropTypeDefaultDescription
userstring"guest"User in the prompt.
hoststring"localhost"Host in the prompt.
pathstring"~"Working directory in the prompt.
groups{ title; links: { label; href }[] }[][]Link columns, printed as the output of ls.
now{ label; value }[]—Lines printed as the output of cat now.txt.
ownerstring—Name after the © sign; leave it out to hide the copyright.
yearnumbercurrent yearYear in the copyright.
noteReactNode—Text after the copyright.
clockbooleanfalseLive HH:MM:SS clock on the date line.
timeZonestringvisitor's ownIANA time zone for the clock.
clockLabelstring—Text before the clock.
backToTopbooleantrueA cd ~ ↑ button that scrolls the window to the top.
childrenReactNode—Content after the last prompt, in place of the cursor.
linkComponentComponentType<{ href; className; children }>"a"Your link component for internal links, e.g. next/link.
classNamestring—Extra classes for the footer.

Accessibility

  • It renders a <footer> landmark. Links sit in a <nav aria-label="Footer"> as plain lists, so the › markers are hidden from screen readers.
  • External links say "(opens in a new tab)" to screen readers. The now lines are a description list.
  • The clock is not a live region and renders --:--:-- on the server, so it never interrupts a screen reader and never causes a hydration mismatch.
  • The cursor stops blinking under prefers-reduced-motion, and the back-to-top button jumps instead of scrolling smoothly.