PromptEnhancer

A prompt box with an Enhance button. It shimmers while working, the rewrite streams in word by word, and Undo restores your draft. AI.

Open playground

About

PromptEnhancer is a React component in the AI category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { PromptEnhancer } from "@ashutoshswamy/smoui" and set onEnhance, defaultValue, placeholder among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { PromptEnhancer } from "@ashutoshswamy/smoui";

<PromptEnhancer onEnhance={async (draft) => (await improve(draft)).text} />

Props 4

onEnhance

Turns the draft into a better one.

(draft: string) => string | Promise<string>
defaultValue

Starting text.

string
placeholder

Empty-state hint.

string
onChange

Called on every edit, including the streamed rewrite.

(value: string) => void