class Text
extends Component
import { Text } from "https://deno.land/x/tui@2.1.11/src/components/mod.ts";
Component for creating single-line, non interactive text
Examples
Example 1
Example 1
new Text({
parent: tui,
text: "Hello there"
theme: {
base: crayon.magenta,
},
rectangle: {
column: 1,
row: 1,
},
zIndex: 0,
});
If you need to use emojis or other multi codepoint characters set multiCodePointSupport
property to true.
Example 2
Example 2
new Text({
...,
text: "🧡",
multiCodePointCharacter: true,
});
Rectangle properties – width
and height
are calculated automatically by default.
To overwrite that behaviour set overwriteRectangle
property to true.
Example 3
Example 3
new Text({
...,
text: "1 2 3 cut me",
overwriteRectangle: true,
rectangle: {
column: 1,
row: 1,
width: 6,
height: 1,
},
})
Constructors
new
Text(options: TextOptions)Properties
drawnObjects: { text: TextObject; }
multiCodePointSupport: Signal<boolean>
overwriteRectangle: Signal<boolean>
text: Signal<string>