标记文本以表示一小段计算机代码。
¥API Reference
此组件基于 code
元素并支持 常用边距属性。
¥This component is based on the code
element and supports common margin props.
¥Examples
¥Size
使用 size
属性控制文本大小。此属性还提供正确的行高和校正的字母间距 - 随着文本大小的增加,相对行高和字母间距会减小。
¥Use the size
prop to control text size. This prop also provides correct line height and corrective letter spacing—as text size increases, the relative line height and letter spacing decrease.
¥Variant
使用 variant
属性控制视觉样式。
¥Use the variant
prop to control the visual style.
¥Color
使用 color
属性指定特定的 color。
¥Use the color
prop to assign a specific color.
¥High-contrast
使用 highContrast
属性增加与背景的颜色对比度。
¥Use the highContrast
prop to increase color contrast with the background.
¥Weight
使用 weight
属性设置文本粗细。
¥Use the weight
prop to set the text weight.
¥Truncate
当文本溢出容器时,使用 truncate
属性用省略号截断文本。
¥Use the truncate
prop to truncate text with an ellipsis when it overflows its container.