PullQuote
A semantic <blockquote> primitive for editorial pull-quotes. The default editorial variant prefixes the quote with an em-dash and caps the width at 50ch; the inline variant is a single-line italic aside with no decoration. Both variants accept optional inline attribution (cite) and a source URL that wraps the attribution in a link.
Premature optimization is the root of all evil.
Installation
npx shadcn@latest add https://craftbits.dev/r/pull-quote.jsonUsage
import { PullQuote } from "@craft-bits/core";
<PullQuote cite="Knuth" source="https://en.wikipedia.org/wiki/Donald_Knuth">
Premature optimization is the root of all evil.
</PullQuote>Prefer the subpath import when you only want this primitive:
import { PullQuote } from "@craft-bits/core/text/pull-quote";Variants
The default editorial variant prefixes the quote with an em-dash and caps the width at 50ch:
<PullQuote>The booth stands finished.</PullQuote>The inline variant drops the em-dash and the max-width — use it as a single-line italic aside inside a paragraph:
<PullQuote variant="inline">a cabinet of seven drawers</PullQuote>Attach attribution via cite. When source is also provided, the attribution becomes a link to the source:
<PullQuote cite="Knuth" source="https://en.wikipedia.org/wiki/Donald_Knuth">
Premature optimization is the root of all evil.
</PullQuote>Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'editorial' | 'inline' | 'editorial' | Visual variant. editorial adds an em-dash prefix and a 50ch max-width. |
cite | ReactNode | — | Attribution rendered after the quote. |
source | string | — | Optional URL. Wraps cite in a link when provided. |
className | string | — | Merged onto the root via cn(). |
children | ReactNode | — | The quoted text. |
All other props are forwarded to the underlying <blockquote> element.
Accessibility
- Uses semantic
<blockquote>with theciteattribute set from thesourceURL when provided. - Source links open in a new tab with
rel="noopener noreferrer"and expose a:focus-visibleunderline. - Pure typography — no
prefers-reduced-motionfallback required.
Credits
- Extracted from:
AlgoFlashcards(src/lessons/primitives/chrome/PullQuote.tsx). The source was a bare<p>with a hardcodedInstrument_Seriffont and atext-foreground/85colour that bypassed the token system, plus an em-dash pseudo-prefix and no attribution slot. The library version promotes the element to a semantic<blockquote>, consumescb-*tokens, adds optionalcite/sourceattribution with a focus-visible link, and splits the API intoeditorialandinlinevariants.