Helper Components
Improve Feature
Dialog component for improving and rewriting text with customizable tone, length, and format options.
This component is automatically installed along with the GencnUIProvider. No additional installation is required.
Usage
The component must be used within a GencnUIProvider context:
import { ImproveFeature } from "@/registry/new-york/gencn-ui/items/shared/components/gencn-ui-improve-feature";
import { GencnUIProvider } from "@/registry/new-york/gencn-ui/items/shared/provider/gencn-ui-provider";
function MyComponent() {
const [open, setOpen] = React.useState(false);
const [text, setText] = React.useState(
"This is a casual text that needs improvement."
);
const handleAccept = (improvedText: string) => {
setText(improvedText);
};
return (
<GencnUIProvider>
<button onClick={() => setOpen(true)}>Improve Text</button>
<ImproveFeature
open={open}
onOpenChange={setOpen}
onAccept={handleAccept}
getCurrentValue={() => text}
/>
</GencnUIProvider>
);
}
