标题层级#

H1 至 H4 的尺寸与字重层级。

启用 JavaScript 后可运行预览;源码和安装命令仍可直接查看。

用法
h1 := f.Slot().Height(40)
h2 := f.Slot().Height(36)
h3 := f.Slot().Height(32)
h4 := f.Slot().Height(30)
components.Typography(canvas, theme, h1.Rect(), components.TypographyH1, "Heading 1")
components.Typography(canvas, theme, h2.Rect(), components.TypographyH2, "Heading 2")
components.Typography(canvas, theme, h3.Rect(), components.TypographyH3, "Heading 3")
components.Typography(canvas, theme, h4.Rect(), components.TypographyH4, "Heading 4")

正文角色#

段落、引导、大号与小号正文。

启用 JavaScript 后可运行预览;源码和安装命令仍可直接查看。

用法
lead := f.Slot().Height(32)
body := f.Slot().Height(28)
large := f.Slot().Height(28)
small := f.Slot().Height(24)
components.Typography(canvas, theme, lead.Rect(),
    components.TypographyLead, "A complete type system for native desktop interfaces")
components.Typography(canvas, theme, body.Rect(),
    components.TypographyParagraph, "Paragraph text uses the theme's font size and foreground color.")
components.Typography(canvas, theme, large.Rect(),
    components.TypographyLarge, "Large · Key note")
components.Typography(canvas, theme, small.Rect(),
    components.TypographySmall, "Small · Compact labels and supporting copy")

强调与弱化#

正文、强调文字与弱化说明。

启用 JavaScript 后可运行预览;源码和安装命令仍可直接查看。

用法
body := f.Slot().Height(32)
strong := f.Slot().Height(30)
note := f.Slot().Height(26)
components.Typography(canvas, theme, body.Rect(),
    components.TypographyParagraph, "Body copy stays clear, stable, and readable.")
components.Typography(canvas, theme, strong.Rect(),
    components.TypographyLarge, "Key results use a heavier weight.")
components.Typography(canvas, theme, note.Rect(),
    components.TypographyMuted, "Secondary notes use the theme's muted foreground.")

安装

将组件源码复制到自己的项目,直接修改。

仓库命令
go run ./cmd/viva add --out ./components/local typography

源码组件用法#

此预览直接调用生产 Go 组件。稳定 ID、值与打开状态仍由应用持有;组件只负责绘制并声明交互语义。

  • 标题旁的源码链接列出了全部选项与视觉决策。
  • 请使用原生命令验证系统文本、焦点、无障碍与平台集成。
  • 浏览器预览验证共享布局和场景行为,不代表原生性能。

验证边界#

示例覆盖当前 API 的代表性状态,但不表示每个桌面后端都已完成真机验证。

键盘操作

Tab 在控件间移动;Ctrl/⌘ K 搜索组件。进入预览后,键盘事件由 Go 运行时处理。