Skip to content

QuoteBlock

SM, under 950B gzipped

A real blockquote/cite pair, not a styled div.

Category
Data display
Budget
sm, single-purpose control
Runtime deps
None

Preview

Preview language
The Analytical Engine has no pretensions to originate anything.
Ada Lovelace

This is the exact fixture the conformance suite renders in CI. Switch the language to see the component mirror and reformat.

Install

npx shadcn@latest add https://kata-ui-rho.vercel.app/r/quote-block.json

Copies the source into your project. Pulls in 1 primitive: cn.

Source

import { cn } from "../lib/cn";

export interface QuoteBlockProps {
  children: React.ReactNode;
  citation?: string;
  className?: string;
}

/**
 * `<blockquote>` with `<cite>` for the attribution — a border-left visual
 * treatment on a plain `<div>` carries none of this to a screen reader,
 * which announces `<blockquote>` as a distinct region.
 */
export function QuoteBlock({ children, citation, className }: QuoteBlockProps) {
  return (
    <figure className={cn("border-s-4 border-neutral-300 ps-4 text-start dark:border-neutral-700", className)}>
      <blockquote className="text-neutral-800 italic dark:text-neutral-200">{children}</blockquote>
      {citation && <figcaption className="mt-2 text-sm text-neutral-500 dark:text-neutral-400">— {citation}</figcaption>}
    </figure>
  );
}

What CI checks

← All components