Skip to content

Text Area

A ztui Text Area with a line-number gutter and multi-line content

<TextArea> is a multi-line editor: caret movement, selection, clipboard, an optional line-number gutter, optional syntax language, and form validation.

import { useState } from "react";
import { TextArea } from "@huyz0/ztui/react";
function Editor() {
const [value, setValue] = useState("line one\nline two");
return (
<TextArea
value={value}
onChange={setValue}
placeholder="Type here…"
lineNumbers
language="typescript"
style={{ height: 12 }}
/>
);
}
  • value / onChange — controlled text.
  • placeholder — shown when empty.
  • lineNumbers — toggle the gutter.
  • language — syntax highlight (needs @huyz0/ztui/syntax).
  • validators / validateOn / onValidate — form validation hooks.

Full demo →