---
title: "Ext.toolbar.TextItem"
description: "xtype 为 tbtext 的 Ext JS 原生组件参考。"
---

> Documentation Index
> Fetch the complete documentation index at: https://ag.879818327.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Ext.toolbar.TextItem

源码定义：`ext-all-debug.js:103260`。分类：按钮、工具栏、菜单与标签页。

## 创建示例

```javascript
var component = Ext.create("Ext.toolbar.TextItem", {
  xtype: "tbtext",
  ariaRole: null,
  baseCls: Ext.baseCSSPrefix + 'toolbar-text',
  renderTpl: '{text}',
  text: '',
  renderTo: Ext.getBody()
});
```

## 属性

| 属性 | 类型 | 默认值 | 说明 | 配置示例 |
| --- | --- | --- | --- | --- |
| `ariaRole` | `Object/null` | `null` | 组件在辅助技术中的 ARIA 角色。 | `ariaRole: null` |
| `baseCls` | `Mixed` | `Ext.baseCSSPrefix + 'toolbar-text'` | 配置 `baseCls` 对应的 CSS 类名。 | `baseCls: Ext.baseCSSPrefix + 'toolbar-text'` |
| `renderTpl` | `String` | `'{text}'` | 配置生成组件内容的 `renderTpl` 模板。 | `renderTpl: '{text}'` |
| `text` | `String` | `''` | 配置组件的 `text` 选项。 | `text: ''` |

## 方法

| 方法 | 参数 | 说明 | 调用示例 |
| --- | --- | --- | --- |
| `beforeRender` | `` | 生成 `before` 的渲染结果。 执行时会保留父类默认行为。源码涉及 `callParent()`。 | `component.beforeRender()` |
| `setText` | `text` | 设置 `text`。 执行时会刷新界面或布局、更新 `text` 状态。源码涉及 `updateLayout()`。 | `component.setText(...)` |

## 事件

源码中未找到该组件自身注册的事件；可监听继承事件。

Source: https://ag.879818327.xyz/ext/navigation/toolbar-textitem/index.mdx
