Section head

Purple eyebrow and a medium-weight two-tone heading, with room for an action.

Rendering

Clean captures, every time. Ads and cookie banners are removed before the shutter.

Install

$ npx shadcn@latest add @nudgekit/section-head

Or with no config: npx shadcn@latest add https://ui.nudgekit.app/r/section-head.json

Brings in @nudgekit/tone, and the theme.

Usage

usage.tsx
import { SectionHead } from "@/components/section-head"

<SectionHead
  eyebrow="Rendering"
  title="Clean captures, every time."
  tone="Ads and cookie banners are removed before the shutter."
/>

Do

  • Start every page section with one.
  • Keep the eyebrow to one or two words.

Don't

  • Write the eyebrow in capitals.

Code

What the CLI writes into your project. It is yours to change.

components/section-head.tsx
import * as React from "react";

import { cn } from "@/lib/utils";
import { Tone } from "@/components/ui/tone";

export interface SectionHeadProps {
  eyebrow?: string;
  title: string;
  tone?: string;
  /** Something on the right, for example a Segmented control or a "View all" link. */
  action?: React.ReactNode;
  className?: string;
}

/** Brand-coloured eyebrow, then a medium two-tone heading. */
function SectionHead({ eyebrow, title, tone, action, className }: SectionHeadProps) {
  return (
    <div data-slot="section-head" className={cn("mb-9 flex flex-wrap items-end justify-between gap-6", className)}>
      <div className="max-w-[640px]">
        {eyebrow && <p className="eyebrow mb-3">{eyebrow}</p>}
        <h2 className="headline text-[clamp(1.5rem,2.6vw,1.75rem)] leading-[1.18]">
          {title} {tone && <Tone>{tone}</Tone>}
        </h2>
      </div>
      {action}
    </div>
  );
}

export { SectionHead };