Skip to main content
Module

x/tui/src/components/mod.ts>Text

🦕 Deno module for creating Terminal User Interfaces
Go to Latest
class Text
extends Component
import { Text } from "https://deno.land/x/tui@2.1.4/src/components/mod.ts";

Component for creating single-line, non interactive text

Examples

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

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

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>

Methods

draw(): void