Skip to content

Text

const Text: ForwardRefExoticComponent<TextProps & RefAttributes<TextHandle>>;

Renders styled text in the terminal.

Supports inline nesting for rich text — wrap portions of text in additional <Text> elements with different styles:

<Text style={{ color: "white" }}>
Hello <Text style={{ bold: true, color: "cyan" }}>World</Text>!
</Text>
// Focusable text with highlight
<Text focusable focusedStyle={{ bg: "cyan", color: "black" }}>
Press Tab to reach me
</Text>

PropertyTypeDescription
children?ReactNodeText content. Can be a string, number, or nested <Text> elements for rich inline styling (bold words inside a sentence, etc.).
focusable?booleanWhen true, the text element participates in the focus (Tab) order.
focusedStyle?StyleStyle applied when this element is focused (merged with style).
style?StyleText style (color, bold, dim, italic, underline, etc.).
wrap?Responsive<WrapMode>Text wrapping mode. Overrides style.wrap. - "wrap" — soft-wrap at the container edge (default) - "truncate" — cut off with no indicator - "ellipsis" — cut off with - "none" — no wrapping at all

Handle for Text (when focusable)

blur(): void;

Programmatically blur (unfocus) this element

void

FocusableHandle.blur


focus(): void;

Programmatically focus this element

void

FocusableHandle.focus


scrollIntoView(options?): void;

Scroll the nearest parent ScrollView to make this element visible. Behaves like the DOM Element.scrollIntoView() method. No-op if the element is not inside a ScrollView.

ParameterTypeDescription
options?ScrollIntoViewOptionsAlignment options (default: { block: "nearest" })

void

const inputRef = useRef<InputHandle>(null);
// Minimal scroll — just enough to make it visible
inputRef.current?.scrollIntoView();
// Center the element in the viewport
inputRef.current?.scrollIntoView({ block: "center" });

FocusableHandle.scrollIntoView

PropertyModifierTypeDescriptionInherited from
isFocusedreadonlybooleanWhether this element is currently focusedFocusableHandle.isFocused