GenCN UI
Helper Components

Fix Grammar Feature

Dialog component for fixing grammar and spelling errors in text using AI-powered proofreading.

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 { FixGrammarFeature } from "@/registry/new-york/gencn-ui/items/shared/components/gencn-ui-fix-grammar-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 text with some erors.");

  const handleAccept = (correctedText: string) => {
    setText(correctedText);
  };

  return (
    <GencnUIProvider>
      <button onClick={() => setOpen(true)}>Fix Grammar</button>
      <FixGrammarFeature
        open={open}
        onOpenChange={setOpen}
        onAccept={handleAccept}
        getCurrentValue={() => text}
      />
    </GencnUIProvider>
  );
}

Component API

On this page