The weex builtin component ‘text’ is used to render text with specified style rule. tag can contain text value only. You can use variable interpolation in the text content with the mark {{}}.

Child Components

This component supports no child components.


  • value(string): text value of this component. This is equal to the content of ‘text’.


var textComponent = this.$el("textid");
this.text = textComponent.attr.value;


  • lines: specify the text lines. Default value is 0 for unlimited.
  • text styles: check out text styles

    • support ‘color’ style.
    • support ‘font-size’ style. iOS: default vlaue 32. Android: platform specify. HTML5: default value 32.
    • support ‘font-style’ style.
    • support ‘font-weight’ style.
    • support ‘text-align’ style.
    • support ‘text-decoration’ style.
    • support ‘text-overflow’ style.
    • support ‘line-height’(available from v0.6.1) style. line-height in iOS is different from h5 and Android, text value will be placed at bottom of line box.
    • not support ‘flex-direction, ‘justify-content’, ‘align-items’ which is active for child nodes, and text has no child nodes.

common styles

check out common styles for components

  • support flexbox related styles.
  • support box model related styles.
  • support ‘position’ related styles.
  • support ‘opacity’, ‘background-color’ etc.


common events

check out common events

  • support ‘click’ event.
  • support ‘appear’ / ‘disappear’ event.



support ttf and woff font format to custom your text, call addRule in dom module to build your own font-family

<div style='flex-direction:row;margin-top:50px'>
<text style='font-family:iconfont4;font-size:50;color:green'>&#xe614;&#xe612;&#xe613;</text>
<text style='font-family:iconfont4;font-size:50;'>&#xe614;&#xe612;&#xe613;&#xe61d;&#xe714;</text>
<text style='font-family:iconfont4;font-size:60;color:blue'>&#xe711;</text>
<text style='font-family:iconfont4;font-size:60;color:green'>&#xe71c;&#xe60b;</text>
module.exports = {
mounted: function() {
var domModule = weex.requireModule('dom');
//目前支持ttf、woff文件,不支持svg、eot类型,moreItem at http://www.iconfont.cn/
domModule.addRule('fontFace', {
'fontFamily': "iconfont2",
'src': "url('http://at.alicdn.com/t/font_1469606063_76593.ttf')"

try it


<div class="wrapper">
<div class="panel">
<text class="text" lines="3">Weex 是一套简单易用的跨平台开发方案,能以 Web 的开发体验构建高性能、可扩展的原生应用。Vue 是一个轻量并且功能强大的渐进式前端框架。</text>
<div class="panel">
<text class="text" lines="3">Weex is an cross-platform development solution that builds high-performance, scalable native applications with a Web development experience. Vue is a lightweight and powerful progressive front-end framework. </text>
<style scoped>
.wrapper {
flex-direction: column;
justify-content: center;
.panel {
width: 600px;
margin-left: 75px;
border-width: 2px;
border-style: solid;
border-color: #BBB;
padding-top: 15px;
padding-bottom: 15px;
padding-left: 15px;
padding-right: 15px;
margin-bottom: 30px;
.text {
lines: 3;
color: #666666;
font-size: 32px;

try it