Text
保留经典字号比例与 20/14 行高节奏的 Duostrap 纯展示排版文本组件。
Duostrap Text 基于 Base Text 提供全部八项独立排版属性,使用经典的 Helvetica Neue / Arial 正文与 Monaco / Menlo 等宽字体栈,并保留归档版本的 2xl 标题刻度与 20/14 正文行高比例。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<article class="flex max-w-xl flex-col gap-3">
<h2>
<proto-ui-duostrap-text
size="2xl"
font="heading"
weight="bold"
leading="relaxed"
tracking="tight"
>
Classic Duostrap Heading (24.5px / 40px)
</proto-ui-duostrap-text>
</h2>
<p>
<proto-ui-duostrap-text size="xl" font="body" leading="relaxed">
A crisp lead paragraph introduces the page before settling
into the classic 20/14 body line-height rhythm.
</proto-ui-duostrap-text>
</p>
<p>
<proto-ui-duostrap-text
size="base"
font="body"
leading="normal"
>
Body copy renders with Helvetica Neue, Helvetica, and Arial at
the archived 1.4286 line-height ratio so dense forms and
tables remain balanced.
</proto-ui-duostrap-text>
</p>
<div class="flex flex-wrap items-center gap-3 pt-1">
<code>
<proto-ui-duostrap-text
size="sm"
font="mono"
tracking="tight"
decoration="underline"
>
@proto.ui/prototypes-duostrap/text
</proto-ui-duostrap-text>
</code>
<proto-ui-duostrap-text
size="sm"
tone="muted"
emphasis="italic"
>
Muted helper copy · #666666
</proto-ui-duostrap-text>
</div>
</article>将于 0.3.0-rc.1 及后续版本中提供。可从 @proto.ui/prototypes-duostrap/text 导入 textRoot(也导出 duostrapTextRoot 与 DuostrapTextRoot 别名),或在工作区模式下通过 CLI 目标 duostrap-text 生成四框架封装。
import * as React from 'react';import { createReactAdapter } from '@proto.ui/adapter-react';import { duostrapTextRoot } from '@proto.ui/prototypes-duostrap/text';
const Text = createReactAdapter(React)(duostrapTextRoot, { rootTag: 'span' });
export function PageHeading() { return ( <h2> <Text size="2xl" font="heading" weight="bold" leading="relaxed"> Overview </Text> </h2> );}Duostrap 排版指标与语义边界
Section titled “Duostrap 排版指标与语义边界”- 归档刻度保留:
size="2xl"对应1.53125rem(16px 根字号下为24.5px);leading="normal"采用经典的20/14(约1.4286)正文行高比例;同时设置size="2xl"与leading="relaxed"时对应2.5rem(40px)经典标题行高。所有尺寸均以rem缩放。 - 行高覆盖与默认恢复:显式传入
leading(除size外)会覆盖size的默认行高;leading="size"保留所选字号自带行高,leading="tighter"为1.1,tracking="tighter"为-0.05em。移除任意属性即可恢复默认值。 - 前景色继承与文本选择:在深色或彩色
Surface内使用tone="inherit"可沿用外层前景色与文字阴影;Text 不强制改写user-select,正文保持自然可选,控件标签遵循所属控件的选择策略。 - 原生语义:标题(
h1–h6)、段落(p)、表单标签(label)与链接(a)仍由外层原生元素负责。
经典字号刻度与 20/14 行高
Section titled “经典字号刻度与 20/14 行高”展示 4xl、3xl、归档 2xl(24.5px / 40px)、xl、base(20/14 行高)、sm 与 xs 的完整层级。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<div class="flex max-w-xl flex-col gap-3">
<h1>
<proto-ui-duostrap-text
size="4xl"
font="heading"
weight="bold"
leading="tighter"
tracking="tighter"
>
4xl · Display Heading (leading="tighter")
</proto-ui-duostrap-text>
</h1>
<h1>
<proto-ui-duostrap-text
size="3xl"
font="heading"
weight="bold"
leading="tight"
>
3xl · Page Title
</proto-ui-duostrap-text>
</h1>
<h2>
<proto-ui-duostrap-text
size="2xl"
font="heading"
weight="bold"
leading="relaxed"
>
2xl · Archived 24.5px Scale with 40px Relaxed Line Box
</proto-ui-duostrap-text>
</h2>
<h3>
<proto-ui-duostrap-text
size="xl"
font="heading"
weight="semibold"
leading="size"
>
xl · Section Subheading (leading="size")
</proto-ui-duostrap-text>
</h3>
<p>
<proto-ui-duostrap-text
size="base"
font="body"
leading="normal"
>
base · Body copy with classic 20/14 (1.4286) normal leading
</proto-ui-duostrap-text>
</p>
<small>
<proto-ui-duostrap-text
size="sm"
font="body"
weight="medium"
leading="size"
>
sm · Compact form help & table cell copy
</proto-ui-duostrap-text>
</small>
<small>
<proto-ui-duostrap-text size="xs" tone="muted" leading="size">
xs · Footnote & badge label
</proto-ui-duostrap-text>
</small>
</div>导语、引文与行内代码
Section titled “导语、引文与行内代码”展示导语段落、斜体引文、等宽代码片段、下划线链接与删除线样式。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<div class="flex max-w-xl flex-col gap-4">
<p>
<proto-ui-duostrap-text size="xl" leading="relaxed">
Lead copy makes an introductory paragraph stand out with
generous line spacing.
</proto-ui-duostrap-text>
</p>
<blockquote class="border-s-4 border-border ps-4">
<proto-ui-duostrap-text emphasis="italic" leading="normal">
"Simplicity and predictable typography keep web applications
timeless."
</proto-ui-duostrap-text>
</blockquote>
<div class="flex flex-wrap items-center gap-3">
<code class="rounded bg-muted px-2 py-0.5">
<proto-ui-duostrap-text size="sm" font="mono" leading="size">
DuostrapTextRoot
</proto-ui-duostrap-text>
</code>
<a href="#api">
<proto-ui-duostrap-text size="sm" decoration="underline">
Browse API reference
</proto-ui-duostrap-text>
</a>
<del>
<proto-ui-duostrap-text
size="sm"
tone="muted"
decoration="line-through"
>
Deprecated .muted class
</proto-ui-duostrap-text>
</del>
</div>
</div>彩色表面与前景色继承
Section titled “彩色表面与前景色继承”展示经典蓝色渐变主表面(solid)、浅蓝信息表面(accent)与白色卡片(outline)上的 tone="inherit"、default 与 muted 对比效果。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<div class="grid max-w-xl grid-cols-1 gap-3 sm:grid-cols-3">
<proto-ui-duostrap-surface
variant="solid"
elevation="raised"
border="all"
>
<div class="flex flex-col gap-1 p-3">
<proto-ui-duostrap-text
size="sm"
weight="bold"
tone="inherit"
>
Primary Gradient
</proto-ui-duostrap-text>
<proto-ui-duostrap-text size="xs" tone="inherit">
tone="inherit" preserves white ink & shadow.
</proto-ui-duostrap-text>
</div>
</proto-ui-duostrap-surface>
<proto-ui-duostrap-surface variant="accent" border="all">
<div class="flex flex-col gap-1 p-3">
<proto-ui-duostrap-text
size="sm"
weight="bold"
tone="inherit"
>
Info Accent
</proto-ui-duostrap-text>
<proto-ui-duostrap-text size="xs" tone="inherit">
Follows classic #d9edf7 tint foreground.
</proto-ui-duostrap-text>
</div>
</proto-ui-duostrap-surface>
<proto-ui-duostrap-surface
variant="outline"
elevation="raised"
border="all"
>
<div class="flex flex-col gap-1 p-3">
<proto-ui-duostrap-text
size="sm"
weight="bold"
tone="default"
>
Default Well
</proto-ui-duostrap-text>
<proto-ui-duostrap-text size="xs" tone="muted">
Muted #666666 caption on white.
</proto-ui-duostrap-text>
</div>
</proto-ui-duostrap-surface>
</div>以下属性属于 Root(DuostrapTextRoot):
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
size | 'xs' 'sm' 'base' 'lg' 'xl' '2xl' '3xl' '4xl' '5xl' | base | 字号刻度;2xl 保留归档的 1.53125rem(24.5px)刻度 |
tone | 'default' 'muted' 'inherit' | default | 文字颜色语义;在彩色表面或按钮内设为 inherit |
weight | 'normal' 'medium' 'semibold' 'bold' | normal | 字重 |
font | 'body' 'heading' 'mono' | body | 字体栈(Helvetica Neue / Arial 或 Monaco / Menlo 等宽) |
leading | 'size' 'tighter' 'tight' 'snug' 'normal' 'relaxed' | normal | 行高;normal 采用 20/14 比例,2xl + relaxed 为 2.5rem(40px),tighter 为 1.1 |
tracking | 'normal' 'tight' 'tighter' | normal | 字距;tight 为 -0.025em,tighter 为 -0.05em |
emphasis | 'normal' 'italic' | normal | 正体或斜体样式 |
decoration | 'none' 'underline' 'line-through' | none | 文本装饰线 |