<text>
Displays text, like a <span> or <p>. Every piece of visible text must be inside one.
Usage
src/app/headline.ts
Import LYNX_ELEMENTS in your component (see Elements).
Warning
Text directly inside a <view> doesn't render, and nothing warns you. Wrap it in <text>.
Attributes
Plus the common attributes, such as id, class and style.
Events
Read the payload from $event.detail (see Handling taps and events).
Plus the common events, such as bindtap.
Methods
These UI methods (Glossary) work on iOS and Android. Call them with invoke() on the element (see Call element methods). A call from a handler returns nothing: to read a result, call invoke() in a main-thread script instead.
Children
A <text> can hold:
- Text, including Angular interpolation such as
{{ name() }}. - Nested
<text>, to style part of the text. It inheritscolorandfont-familyfrom its parent<text>, even though CSS inheritance is otherwise off. <image>, laid out inline with the text.<view>, laid out inline like an inline block.<inline-truncation>, as a direct child. Its content replaces the "…" whentext-maxlinetruncates the text, and shows only then.
Related
- Elements and layout
- CSS on Lynx: text styles,
remand inheritance - Custom fonts
- Measure text
