For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/components/basic/text.md.

text

文本渲染组件,是展示文字内容的基础元件,支持文字样式配置。

扫码预览

扫码预览 text

Props

属性名类型默认值必填说明
childrenReactNode-否子元素
classNamestring-否组件类名
customContextMenubooleanfalse否开启文本选择后,是否使用自定义弹窗菜单
flattenbooleantrue否是否将节点扁平化以加速渲染,开启文本选择等需要真实节点的能力时需设为 false
idstring-否元素的唯一标识
keystring | number | null-否React key 属性
onClick(event: TouchEvent) => void-否点击时的回调函数
onLayout(event: LayoutEvent) => void-否文本布局完成时触发,事件对象包含文本布局信息
onSelectionChange(event: SelectionChangeEvent) => void-否文本选择变化时触发(需开启 text-selection)
refRef<NodesRef>-否用于获取组件实例的 ref
styleCSSProperties-否组件样式
tailColorConvertbooleanfalse否文本截断时,省略号颜色是否使用外层 text 标签样式(默认使用最近 inline-text 样式)
textMaxlinestring-否文本显示的最大行数,超出将显示省略号
textSelectionbooleanfalse否是否开启文本选择功能,开启时需同时设置 flatten={false}
textSingleLineVerticalAlign"bottom" | "top" | "center" | "normal"'normal'否单行纯文本在行内垂直居中/对齐方式,inline 文本不支持