Skip to content

TextArea

A field for longer text.

Updated View as Markdown
Preview

Loading preview…

root = Form("feedback", TextArea("notes", "What could be better?", placeholder:"Tell us more…", rows:4, maxLength:500, hint:"Up to 500 characters"))

Signature

This is the line a model reads in the system prompt.

TextArea(name, label, placeholder:str, value:str, rows:num, minLength:num, maxLength:num, error:str, bind:$var, size:Size, hint:str, required)
  • Group: Forms
  • Children: No
  • Positional arguments: name, label (a trailing ? means it may be left out)

Props

Prop Type How to write it Notes
name string positional, required
label string positional, required
placeholder string named: placeholder:…
value string named: value:…
rows number named: rows:… Default 4.
minLength number named: minLength:…
maxLength number named: maxLength:…
error string named: error:…
bind $state variable bind:$name two-way binding to a $variable
size sm · md · lg named: size:… Also accepts small, medium, large.
hint string named: hint:… help text under the field
required flag bare word: required

Use your own component

Keep the name and schema, swap what is drawn. The prompt and the model’s output do not change.

import { ui } from "@gistui/react/ui";

const lib = ui.extend({ TextArea: MyTextArea });
<GistUI library={lib} stream={response.body} />;
<GistUI :source="answer" :components="{ TextArea: MyTextArea }" />
<GistUI source={answer} components={{ TextArea: MyTextArea }} />
<GistUI source={answer()} components={{ TextArea: MyTextArea }} />
import { ui } from "@gistui/vanilla/ui";

const lib = ui.extend({ TextArea: (ctx) => ({ el: myElement(ctx) }) });

See Custom components for the full contract. Style hook: [data-gistui="TextArea"].

Navigation

Type to search…

↑↓ navigate↵ selectEsc close