Skip to content
Hazine

Command Pill Hero

Heading and a two-weight intro above an inverted monospace command pill with a prompt glyph and a labelled copy action, then a footnote and links to docs and the repository. Use as the default hero for a CLI or package.

How it differs. One command and one copy action: the inverted pill is the primary call to action, split by a hairline into command and copy cell, which stack when the container is narrower than 32rem.

Install

pnpm dlx shadcn@latest add @hazine/hero-command-pill

Adds 1 file, 1 shadcn primitive (button), 2 Hazine items (@hazine/heading, @hazine/use-controllable-state), and 2 packages (lucide-react, class-variance-authority).

First time? Add the registry to components.json
{
  "registries": {
    "@hazine": "https://api.hazine.dev/r/{name}.json"
  }
}

Needed once per project. Items resolve each other through the @hazine namespace.

Props12

title
string = "Preview every pull request on its own URL"
lead
string = "Slipway builds each branch into an isolated preview."
First clause of the intro sentence, set in the foreground colour.
description
string = "The link is posted on the pull request, and the preview is removed when the branch merges."
Rest of the intro sentence, muted.
headingLevel
HeadingLevel = 1
command
string = "npx slipway@latest init"
The shell command, without the prompt glyph.
footnote
string | null = "Needs Node 20 or later. Adds one config file to the repository."
One line under the pill. Pass null to leave it out.
docsHref
string | null = "#docs"
Pass null to leave the docs link out.
repositoryHref
string | null = "#repository"
Pass null to leave the repository link out.
copyStatus
CopyStatus
defaultCopyStatus
CopyStatus = "idle"
onCopyStatusChange
(status: CopyStatus) => void
onCommandCopy
(command: string) => void
Called after the command reached the clipboard.

Also accepts every prop of Omit<React.ComponentProps<"section">, "title"> and VariantProps<typeof heroCommandPillVariants>.

Accessibility

Pattern
Landmarks and headings, Button (APG, opens in a new tab)
Keyboard
Keyboard support for Command Pill Hero
KeyEffect
TabMoves to the copy button, then the docs link, then the repository link
Enter or Space on Copy commandCopies the command and shows Copied for two seconds. If the clipboard is blocked, the command is selected and a message says so
Enter on a linkFollows the docs or repository link
Screen reader

Section labelled by its heading, whose level is a prop. The command is a code element read left to right with a hidden prompt glyph. Copy is a native button with a visible label, and the result is announced through a polite status region.

  • Announces: Command copied to clipboard.
  • Announces: The clipboard is blocked on this page. The command is selected, so copy it with your keyboard shortcut.
Reduced motion
No motion. Colour transitions only.
Checked
Not checked yet. Automated results appear here once CI has run.

Dependencies5

  • button
  • @hazine/heading
  • @hazine/use-controllable-state
  • lucide-react
  • class-variance-authority

Filled chips are registry items the CLI adds for you. Outlined chips are npm packages.

Tokens shipped0

None. The item is styled by the tokens your theme already has.

More in Heroes