React Component logo
Embed & Developer

React Component

A drop-in React chat component with a headless hook option

What is React Component?

@keluhq/react is the Kelu package for React apps. It has two options: a finished chat panel (<KeluChat />) and a headless hook (useKeluChat) that handles streaming, state, and errors while leaving the UI to you. It runs on @keluhq/sdk, which installs with it, and needs react and react-dom 18 or later.

Integration

How Kelu works with React Component

Everything you can do once the integration is connected.

01

<KeluChat />: a finished chat panel

Streaming answers with citations in one component. Set the welcome message, placeholder, and brand color with props.

02

useKeluChat: your own markup

The hook returns messages, ask, isStreaming, error, and reset. You render them in your own design system.

03

Thumbs up and down

Both the component and the hook send per-message thumbs up and down feedback.

04

Same pipeline everywhere

The React package, the widget, and the API run the same retrieval, grounding, and citations.

Setup

How to set it up

  1. 1

    Run npm install @keluhq/react. Your project needs react and react-dom 18 or later.

  2. 2

    Create a public client key (kl_pk_...) under the knowledge base's Integrations > Client Keys. The Developer SDKs tab beside it shows the code with your knowledge base ID and key filled in.

  3. 3

    Render <KeluChat knowledgeBaseId="..." clientKey="kl_pk_..." /> where the chat should appear, or call useKeluChat to build your own UI. In the Next.js App Router, put it in a client component ("use client").

Got questions?

React Component — Frequently Asked Questions

Common questions about connecting Kelu to React Component.

Ready to connect React Component?

Start free. No credit card required.