Helper Components
Compose Feature
Dialog component for composing text content using AI-powered writing capabilities with customizable tone, format, and length 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 { ComposeFeature } from "@/registry/new-york/gencn-ui/items/shared/components/gencn-ui-compose-feature";
import { GencnUIProvider } from "@/registry/new-york/gencn-ui/items/shared/provider/gencn-ui-provider";
function MyComponent() {
const [open, setOpen] = React.useState(false);
const handleAccept = (text: string) => {
// Use the composed text
};
return (
<GencnUIProvider>
<button onClick={() => setOpen(true)}>Compose</button>
<ComposeFeature
open={open}
onOpenChange={setOpen}
onAccept={handleAccept}
writerOptions={{
tone: "casual",
format: "plain-text",
length: "medium",
}}
placeholderPrompt="Describe what you want to write..."
/>
</GencnUIProvider>
);
}
