TextBlock
TextBlock 为一个具有宽度的容器,会把文本撑满整行,一般用于显示整段段落或文本。
预览

示例代码
render('Checkout::Dynamic::Render', (root) => {
return
<TextBlock>
Cozy up in style!
Snuggle-ready knit, 6 colors, 50 % OFF today—grab your new favorite sweater before stock melts away!
</TextBlock>;
});
TextBlockProps
提示
标注 ? 的属性为可选,未标注 ? 的属性为必选。
size?
extraSmall
small
base
medium
large
extraLarge
extraExtraLarge
number
默认值:base
文本的大小。行高自动设置为字体的 1.5 倍,例如 10px/15px 表示字体大小 10px,行高为 15px。具体配置如下:
extraSmall:10px/15pxsmall:12px/18pxbase:14px/21pxmedium:16px/24pxlarge:18px/27pxextraLarge:24px/36pxextraExtraLarge:28px/42px
支持输入自定义大小如 20。当前自定义大小限制最大值为 48。超过最大值则不生效,恢复默认的 base 设置。自定义大小示例如下:
render('Checkout::Dynamic::Render', (root) => { return <Text size={48}>Total</Text>; });
emphasis?
italic
bold
斜体或粗体。
id?
string
用于标识当前组件的唯一标识符。如果未设置 ID,则会使用全局唯一值,全局唯一值为组件内部自行创建的 ID。
appearance?
accent
subdued
info
success
warning
critical
string
更改元素的颜色,支持输入自定义颜色如 red、#ccc。
decoration
TextDecoration
文本装饰。
类型说明
TextDecoration
type TextDecoration = 'lineThrough'
lineThrough:配置该项时表示为删除线样式
这篇文章对你有帮助吗?