Soft Correct
A text box that autocorrects as you type and leaves every change in sight. A faint underline marks each fix, and what you typed lingers underneath while the call was close.
Needs: A word list, most common first (the demo uses 12,000 English words, about 134 KB with the pair table). No model: the speller runs in the component.
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| words | string[] | required | The dictionary, most common word first. Probabilities come from the rank. |
| pairs | string | – | Next-word table, "prev next P(next|prev)" entries joined by commas, so the word before can tip a close call. |
| defaultValue | string | "" | Starting text. Typos in it are corrected on mount, quietly. |
| learned | { word: string; seen: number }[] | – | Words learned before (kept from onLearnedChange), so it remembers between visits. Read once. |
| onLearnedChange | (learned: { word: string; seen: number }[]) => void | – | Called whenever a word is learned or forgotten. Save it and pass it back as learned. |
| onChange | (value: string) => void | – | Called with the text, corrections included, on every change. |
| placeholder | string | "Message" | Shown while the box is empty. |
| label | string | "Message" | Accessible name for the text box. |
| size | number | 18 | Font size of the text, in px. |
| accent | string | "#2f6fed" | Caret, focus ring and selection colour, any CSS colour. Left unset, a lighter blue is used in dark mode. Corrections are never coloured. |
| className | string | – | Class on the root element. |
| style | CSSProperties | – | Style on the root element. Theme it through the --mlui-* variables. |