Integrate via React

SnippetAI is a React package designed to simplify generating code samples directly from OpenAPI specifications, enabling developers to rapidly prototype and integrate APIs into their applications.

Installation

To install SnippetAI in your React project, install it using your package manager of choice:

npm
npm install @speakeasy-api/snippet-ai-react

Usage

After installation, import and utilize SnippetAI in your React components. An active publishing token is required. You can generate one in the settings page for your organization.

import { SnippetAI } from "@speakeasy-api/snippet-ai-react";
function MyComponent() {
return <SnippetAI codeLang="typescript" publishingToken="PUBLISHING_TOKEN" />;
}
export default MyComponent;

Supported Languages

SnippetAI currently supports code generation for the following languages:

LanguageSupported
TypeScript
Python
PHP
Java
C#
Go

Props

The SnippetAI component accepts the following props:

PropTypeDescriptionDefault
codeLangstringProgramming language for suggestion results (typescript, python, go, java, csharp, php)typescript
toggleShortcutstringKeyboard shortcut to open the Command Bar$mod+k (cmd+k / ctrl+k)
zIndexstringZ-index of the command bar1000
suggestionsstring[]Searchable list of suggestions for the command bar[]