Skip to content
View Markdown

TextEditor ​

A field for editing multiple lines of text.

tsx
import { TextEditor } from '@satinhq/kit'

Example ​

Full example
tsx
import { useState } from 'react'
import { List, Screen, Section, TextEditor } from '@satinhq/kit'

function Example() {
  const [text, setText] = useState('')

  return (
    <Screen>
      <List id="example">
        <Section>
          <TextEditor label="Notes" value={text} onChange={setText} />
        </Section>
      </List>
    </Screen>
  )
}

Bind the text ​

Keep the text in React state. Pass the string to value and its setter to onChange.

Name the field ​

Use label for its accessible name. A prompt supplies placeholder text when the field is empty.

Bound the editor's growth ​

Use minLines and maxLines to bound the editor's height. Return inserts a line break; use a separate Button for saving or sending the text.

API ​

Scroll horizontally to read every column.

PropTypeDescription
labelstringThe accessible name.
valuestringThe current text.
onChange(value: string) => voidReceives edited text.
promptstringOptional placeholder.
minLinesnumberMinimum visible lines.
maxLinesnumberOptional growth limit.

Related: Quick start, List, Screen.

:::

Satin runs on the Lumen rendering engine and is open source under the MIT License.