Skip to documentation

Design system / Sources & standards

Current repository source

content-heading.tsx

src/components/editorial/content-heading.tsx

This view contains the escaped source read during the deployment build. Code and policy text are unchanged. Markdown is shown as source, not rendered as a document. A new deployment refreshes the content.

import type { ComponentProps, ReactNode } from "react";
import { Text } from "@/components/ui/text";
import { cn } from "@/lib/utils";

/** Editorial molecule: semantic heading + optional owner-authored context. */
export function ContentHeading({
  title,
  eyebrow,
  description,
  descriptionWidth = "reading",
  level = 1,
  index,
  className,
  ...props
}: Omit<ComponentProps<"header">, "title" | "children"> & {
  title: ReactNode;
  eyebrow?: ReactNode;
  description?: string;
  /** Full-width context for collection headings; reading copy keeps its measure. */
  descriptionWidth?: "reading" | "full";
  level?: 1 | 2 | 3;
  index?: ReactNode;
}) {
  const Heading = `h${level}` as "h1" | "h2" | "h3";
  return (
    <header
      {...props}
      data-slot="content-heading"
      className={cn("space-y-6", className)}
    >
      {eyebrow != null && (
        <Text variant="eyebrow" className="uppercase text-text-muted">
          {eyebrow}
        </Text>
      )}
      <Heading
        className={cn(
          "break-words font-semibold tracking-tight",
          level === 1 ? "text-secondary-title-jumbo" : "text-title",
        )}
      >
        {index != null && (
          <Text
            as="span"
            variant="eyebrow"
            accent="monospace"
            aria-hidden
            className="mr-3 text-text-muted"
          >
            {index}
          </Text>
        )}
        {title}
      </Heading>
      {description != null && (
        <Text rhythm="loose" className={cn(descriptionWidth === "reading" ? "max-w-3xl" : "w-full", "text-text-muted")}>
          {description}
        </Text>
      )}
    </header>
  );
}
All sources and standards
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.