Answer Versions
The versions of an answer you get by regenerating, with a pager drawn in dots: an arrow each side, a dot for each version, the one shown a lit pill, and the newest breathing while it's still being written. Switching versions resolves the new text in through a blue-noise dissolve, and the words that differ from the version you came from get a dotted underline that fades after a few seconds, so you can see what the regeneration actually changed.
Needs: None. Canvas 2D and a CSS mask.
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| versions | string[] | required | Each version of the answer, oldest first. The last may still be streaming. |
| index | number | – | The version shown, when you hold it. The newest by default. |
| onIndexChange | (index: number) => void | – | Called when another version is chosen. |
| onRegenerate | () => void | – | Called by the Regenerate button; leave unset to hide it. |
| generating | boolean | false | The newest version is still being written. |
| showChanges | boolean | true | Mark the words that changed from the version you came from. |
| tone | string | – | The lit dot and the change marks. The page's accent by default. |
| pitch | number | 3 | Size of one dot in px. |
| className | string | – | Class on the answer. |
| style | CSSProperties | – | Style on the answer. |