Text
Shadcn typography primitive with consistent scale, weight, font family, leading, tracking, and ink semantics.
Text inherits the eight independent presentation axes of Base Text and applies Shadcn typography and ink tokens while leaving document structure and interaction semantics to enclosing native elements. The examples on this page use the Shadcn Rhea style preset.
Preview
Section titled “Preview”<article class="flex max-w-xl flex-col gap-5">
<header class="flex flex-col gap-2">
<h1>
<proto-ui-shadcn-text
size="4xl"
font="heading"
weight="bold"
leading="tight"
tracking="tight"
>
Taxing Laughter: The Joke Tax Chronicles
</proto-ui-shadcn-text>
</h1>
<p>
<proto-ui-shadcn-text
size="xl"
tone="muted"
leading="relaxed"
>
Once upon a time, in a far-off land, a restless court looked
for a fairer way to fund the royal treasury.
</proto-ui-shadcn-text>
</p>
</header>
<h2 class="border-b border-border pb-2">
<proto-ui-shadcn-text
size="2xl"
font="heading"
weight="semibold"
leading="tight"
tracking="tight"
>
The King's Plan
</proto-ui-shadcn-text>
</h2>
<p>
<proto-ui-shadcn-text leading="relaxed">
The king thought long and hard, and finally proposed
</proto-ui-shadcn-text>
<a href="#examples">
<proto-ui-shadcn-text weight="medium" decoration="underline">
a brilliant plan
</proto-ui-shadcn-text>
</a>
<proto-ui-shadcn-text leading="relaxed">
: taxing every pun and one-liner told in the kingdom.
</proto-ui-shadcn-text>
</p>
<blockquote class="border-s-2 border-border ps-4">
<proto-ui-shadcn-text emphasis="italic" leading="relaxed">
"After all, everyone enjoys a good joke, so it is only fair
that they pay for the privilege."
</proto-ui-shadcn-text>
</blockquote>
<div class="flex flex-wrap items-center gap-2">
<code class="rounded bg-muted px-2 py-0.5">
<proto-ui-shadcn-text
size="sm"
font="mono"
weight="semibold"
leading="size"
>
@proto.ui/prototypes-shadcn/text
</proto-ui-shadcn-text>
</code>
<proto-ui-shadcn-text size="sm" tone="muted">
Shadcn Rhea · Geist & CJK fallback ready
</proto-ui-shadcn-text>
</div>
</article>Installation
Section titled “Installation”Initialize your app via the Quick Start guide, then add shadcn-text (draft capabilities are also available directly from workspace source):
This component is available from workspace source. In your application, install the CLI, Shadcn prototypes and target adapter built from the same workspace revision, then initialize the project with that CLI. Run the locally installed CLI to generate the facade.
npm exec -- proto-ui add wc shadcn-text
pnpm exec proto-ui add wc shadcn-text
Replace wc with react, vue, or vue2 to generate the local facade for your target framework.
Compose the generated ShadcnTextRoot component inside native h1–h4, p, blockquote, code, label, or a elements:
import { ShadcnTextRoot } from '../proto-ui/components/react';
export function SectionTitle() { return ( <h1> <ShadcnTextRoot size="4xl" font="heading" weight="bold" leading="tight" tracking="tight"> Account settings </ShadcnTextRoot> </h1> );}You can also import shadcnTextRoot (aliased as textRoot and ShadcnTextRoot) from @proto.ui/prototypes-shadcn/text with { rootTag: 'span' } on your Web Adapter, and optionally apply the immutable SHADCN_TYPOGRAPHY preset (Geist paired with platform and CJK fallbacks; font delivery and licensing stay with the host app):
import { shadcnTextRoot, SHADCN_TYPOGRAPHY } from '@proto.ui/prototypes-shadcn/text';Semantics and typography rules
Section titled “Semantics and typography rules”- Native semantic ownership: Text adds no ARIA role, tab stop, or event handler. Keep heading levels,
label(htmlFor/for), and anchor (href,target,download) semantics on the surrounding native elements. - Size-owned line boxes & tight steps:
leading="size"retains each size token’s built-in line height (xs1rem,sm1.25rem,base1.5rem,lg1.75rem,xl1.75rem,2xl2rem,3xl2.25rem,4xl2.5rem,5xl1).leading="tighter"maps to1.1, andtracking="tighter"maps to-0.05em. - Defaults and fallback: Removing any prop restores its default. An invalid initial
sizefalls back tobase, while an invalid update after a valid value retains the previous valid value. - Action typography (
actionProfile): Defaults to'none'and never subscribes implicitly toshadcn-style-scope. Passing an explicit preset applies its action line box (1.25remforrhea,luma,vega,nova,maia,new-york-v4;1remforlyraandsera;1.625formira, with uppercase and wide tracking forsera).
Examples
Section titled “Examples”Type scale and weights
Section titled “Type scale and weights”Compare the full 5xl through xs scale together with leading="tighter", leading="size", and tracking="tighter".
<div class="flex max-w-xl flex-col gap-3">
<h1>
<proto-ui-shadcn-text
size="5xl"
font="heading"
weight="bold"
leading="tighter"
tracking="tighter"
>
5xl · Display Title
</proto-ui-shadcn-text>
</h1>
<h1>
<proto-ui-shadcn-text
size="4xl"
font="heading"
weight="bold"
leading="tight"
tracking="tight"
>
4xl · Page Heading
</proto-ui-shadcn-text>
</h1>
<h2>
<proto-ui-shadcn-text
size="3xl"
font="heading"
weight="semibold"
leading="tight"
tracking="tight"
>
3xl · Section Heading
</proto-ui-shadcn-text>
</h2>
<h3>
<proto-ui-shadcn-text
size="2xl"
font="heading"
weight="semibold"
leading="snug"
tracking="tight"
>
2xl · Subsection Heading
</proto-ui-shadcn-text>
</h3>
<h4>
<proto-ui-shadcn-text
size="xl"
font="heading"
weight="semibold"
leading="size"
>
xl · Card Title
</proto-ui-shadcn-text>
</h4>
<p>
<proto-ui-shadcn-text
size="lg"
weight="semibold"
leading="size"
>
lg · Large Callout
</proto-ui-shadcn-text>
</p>
<p>
<proto-ui-shadcn-text
size="base"
weight="normal"
leading="normal"
>
base · Default body copy for paragraphs and descriptions.
</proto-ui-shadcn-text>
</p>
<small>
<proto-ui-shadcn-text size="sm" weight="medium" leading="size">
sm · Compact control label & metadata
</proto-ui-shadcn-text>
</small>
<small>
<proto-ui-shadcn-text size="xs" tone="muted" leading="size">
xs · Caption, badge, and keyboard hint
</proto-ui-shadcn-text>
</small>
</div>Editorial and inline styles
Section titled “Editorial and inline styles”Common compositions for lead copy, large callouts, italic blockquotes, inline monospace code, underlined links, strikethrough text, and form helper captions.
<div class="flex max-w-xl flex-col gap-4">
<p>
<proto-ui-shadcn-text size="xl" tone="muted" leading="relaxed">
A modal dialog that interrupts the user with important content
and expects a response.
</proto-ui-shadcn-text>
</p>
<p>
<proto-ui-shadcn-text
size="lg"
weight="semibold"
leading="snug"
>
Are you absolutely sure?
</proto-ui-shadcn-text>
</p>
<blockquote class="border-s-2 border-border ps-4">
<proto-ui-shadcn-text emphasis="italic" leading="relaxed">
"Clear typography turns complex workflows into calm reading."
</proto-ui-shadcn-text>
</blockquote>
<div class="flex flex-wrap items-center gap-3">
<code class="rounded bg-muted px-2 py-0.5">
<proto-ui-shadcn-text
size="sm"
font="mono"
weight="semibold"
leading="size"
>
npx @proto.ui/cli add react shadcn-text
</proto-ui-shadcn-text>
</code>
<a href="#api">
<proto-ui-shadcn-text
size="sm"
weight="medium"
decoration="underline"
>
View API table
</proto-ui-shadcn-text>
</a>
<del>
<proto-ui-shadcn-text
size="sm"
tone="muted"
decoration="line-through"
>
Legacy 13px copy
</proto-ui-shadcn-text>
</del>
</div>
<div class="flex flex-col gap-1">
<small>
<proto-ui-shadcn-text
size="sm"
weight="medium"
leading="tight"
>
Email address
</proto-ui-shadcn-text>
</small>
<p>
<proto-ui-shadcn-text size="sm" tone="muted">
Enter your work email to receive release notifications.
</proto-ui-shadcn-text>
</p>
</div>
</div>Tones and surface inheritance
Section titled “Tones and surface inheritance”Use tone="inherit" inside solid or accent Surface containers so text inherits the paired foreground ink across both light and dark modes.
<div class="grid max-w-xl grid-cols-1 gap-3 sm:grid-cols-2">
<proto-ui-shadcn-surface variant="outline" radius="lg">
<div class="flex flex-col gap-1 p-4">
<proto-ui-shadcn-text
size="sm"
weight="semibold"
tone="default"
>
Default Ink
</proto-ui-shadcn-text>
<proto-ui-shadcn-text size="sm" tone="muted">
Muted secondary copy on a neutral surface.
</proto-ui-shadcn-text>
</div>
</proto-ui-shadcn-surface>
<proto-ui-shadcn-surface
variant="solid"
radius="lg"
border="none"
>
<div class="flex flex-col gap-1 p-4">
<proto-ui-shadcn-text
size="sm"
weight="semibold"
tone="inherit"
>
Solid Surface · tone="inherit"
</proto-ui-shadcn-text>
<proto-ui-shadcn-text size="sm" tone="inherit">
Inherits primary-foreground ink automatically.
</proto-ui-shadcn-text>
</div>
</proto-ui-shadcn-surface>
<proto-ui-shadcn-surface
variant="accent"
radius="lg"
border="none"
>
<div class="flex flex-col gap-1 p-4">
<proto-ui-shadcn-text
size="sm"
weight="semibold"
tone="inherit"
>
Accent Surface · tone="inherit"
</proto-ui-shadcn-text>
<proto-ui-shadcn-text size="sm" tone="inherit">
Stays paired with accent-foreground in light and dark mode.
</proto-ui-shadcn-text>
</div>
</proto-ui-shadcn-surface>
<proto-ui-shadcn-surface
variant="muted"
radius="lg"
border="none"
>
<div class="flex flex-col gap-1 p-4">
<proto-ui-shadcn-text
size="sm"
weight="semibold"
tone="default"
>
Muted Surface
</proto-ui-shadcn-text>
<proto-ui-shadcn-text size="sm" tone="muted">
Supports default and muted hierarchy cleanly.
</proto-ui-shadcn-text>
</div>
</proto-ui-shadcn-surface>
</div>Action typography profiles (actionProfile)
Section titled “Action typography profiles (actionProfile)”Pair actionProfile with matching passive action Surface recipes for Rhea, Luma, Lyra, Mira, and Sera.
<div
id="text-action-profiles"
class="flex flex-wrap items-center gap-3"
>
<proto-ui-shadcn-surface variant="solid">
<span class="block px-3 py-1.5">
<proto-ui-shadcn-text
size="sm"
weight="medium"
tone="inherit"
>
Rhea · 1.25rem
</proto-ui-shadcn-text>
</span>
</proto-ui-shadcn-surface>
<proto-ui-shadcn-surface variant="secondary">
<span class="block px-3 py-1.5">
<proto-ui-shadcn-text
size="sm"
weight="medium"
tone="inherit"
>
Luma · 1.25rem
</proto-ui-shadcn-text>
</span>
</proto-ui-shadcn-surface>
<proto-ui-shadcn-surface variant="outline">
<span class="block px-2.5 py-1.5">
<proto-ui-shadcn-text
size="xs"
weight="medium"
tone="inherit"
>
Lyra · 1rem
</proto-ui-shadcn-text>
</span>
</proto-ui-shadcn-surface>
<proto-ui-shadcn-surface variant="secondary">
<span class="block px-2.5 py-1">
<proto-ui-shadcn-text
size="xs"
weight="medium"
tone="inherit"
>
Mira · relaxed
</proto-ui-shadcn-text>
</span>
</proto-ui-shadcn-surface>
<proto-ui-shadcn-surface variant="solid">
<span class="block px-3 py-1.5">
<proto-ui-shadcn-text
size="xs"
weight="semibold"
tone="inherit"
>
Sera · Uppercase
</proto-ui-shadcn-text>
</span>
</proto-ui-shadcn-surface>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const profiles = ['rhea', 'luma', 'lyra', 'mira', 'sera'];
const root = document.querySelector('#text-action-profiles');
root
?.querySelectorAll('proto-ui-shadcn-surface')
.forEach((el, i) =>
setElementProps(el, { actionProfile: profiles[i] })
);
root
?.querySelectorAll('proto-ui-shadcn-text')
.forEach((el, i) =>
setElementProps(el, { actionProfile: profiles[i] })
);
</script>RTL and multilingual typography
Section titled “RTL and multilingual typography”Text follows enclosing logical direction (dir="rtl") and pairs cleanly with CJK fallback stacks.
<div class="flex max-w-xl flex-col gap-5">
<section
dir="rtl"
lang="ar"
class="flex flex-col gap-3 rounded-lg border border-border p-4 text-start"
>
<h2>
<proto-ui-shadcn-text
size="2xl"
font="heading"
weight="bold"
leading="tight"
>
فرض الضرائب على الضحك: سجلات ضريبة النكتة
</proto-ui-shadcn-text>
</h2>
<p>
<proto-ui-shadcn-text tone="muted" leading="relaxed">
تتبع النصوص اتجاه الحاوية المنطقي مع الحفاظ على تدرج الخطوط
وارتفاع الأسطر عبر اللغات من اليمين إلى اليسار.
</proto-ui-shadcn-text>
</p>
<blockquote class="border-s-2 border-border ps-4">
<proto-ui-shadcn-text
size="sm"
emphasis="italic"
leading="relaxed"
>
«الجميع يستمتع بنكتة جيدة عندما تكون القراءة مريحة وواضحة.»
</proto-ui-shadcn-text>
</blockquote>
</section>
<section
lang="zh-CN"
class="flex flex-col gap-2 rounded-lg border border-border p-4 text-start"
>
<h3>
<proto-ui-shadcn-text
size="xl"
font="heading"
weight="semibold"
leading="snug"
>
中英混排与 CJK 回退示例 · Geist + System CJK
</proto-ui-shadcn-text>
</h3>
<p>
<proto-ui-shadcn-text
size="sm"
tone="muted"
leading="relaxed"
>
搭配 SHADCN_TYPOGRAPHY 预设时,拉丁字符优先使用
Geist,中文字符平滑回退至系统无衬线字体。
</proto-ui-shadcn-text>
</p>
</section>
</div>The following props belong to Root (ShadcnTextRoot):
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'xs' 'sm' 'base' 'lg' 'xl' '2xl' '3xl' '4xl' '5xl' | base | Font size scale; pair with leading="size" to keep built-in line boxes |
tone | 'default' 'muted' 'inherit' | default | Ink tone; use inherit inside solid or accent surfaces |
weight | 'normal' 'medium' 'semibold' 'bold' | normal | Font weight |
font | 'body' 'heading' 'mono' | body | Font family role (body, heading, or monospace) |
leading | 'size' 'tighter' 'tight' 'snug' 'normal' 'relaxed' | normal | Line height; size keeps the size token line box and tighter maps to 1.1 |
tracking | 'normal' 'tight' 'tighter' | normal | Letter spacing; tight maps to -0.025em and tighter maps to -0.05em |
emphasis | 'normal' 'italic' | normal | Normal or italic font style |
decoration | 'none' 'underline' 'line-through' | none | Text decoration line |
actionProfile | 'none' 'vega' 'nova' 'maia' 'lyra' 'mira' 'luma' 'sera' 'rhea' 'new-york-v4' 'new-york' | none | Explicit passive action typography recipe (Shadcn-only; never subscribes implicitly to style-scope) |