---
title: React API
description: Component props, appearance options, and chat controls.
icon: Code
---

## Components

| Component             | Required props                     | Function                     |
| --------------------- | ---------------------------------- | ---------------------------- |
| `CoristenWidget`      | `apiKey` or `identity`             | Show a floating chat button. |
| `CoristenDock`        | Access prop, `children`, `trigger` | Open chat in a side panel.   |
| `CoristenModal`       | Access prop, `trigger`             | Open chat over the page.     |
| `CoristenContactForm` | `apiKey` or `identity`             | Send a form message.         |

All components use the same API key pair. Use one public key or one identity route across your application.
Do not supply `apiKey` with `identity`.

## Access props

| Prop       | Type     | Function                                              |
| ---------- | -------- | ----------------------------------------------------- |
| `apiKey`   | `string` | Supply the public key with the `coristen_pk_` prefix. |
| `identity` | `string` | Supply a server route on the same website.            |
| `apiUrl`   | `string` | Set the Coristen service URL for your deployment.     |

See [installation](/installation) and [customer identity](/customer-identity).

## Common options

| Prop         | Type                     | Function                                  |
| ------------ | ------------------------ | ----------------------------------------- |
| `appearance` | `WidgetAppearance`       | Set the appearance for one installation.  |
| `fontSize`   | `string`                 | Set a CSS font size for widget content.   |
| `onReady`    | `() => void`             | Run a function when the session is ready. |
| `onError`    | `(error: Error) => void` | Receive a connection or chat error.       |

## Chat options

These options apply to the floating widget, dock, and modal.
They do not control the contact form.

| Prop           | Type                      | Default            | Function                                 |
| -------------- | ------------------------- | ------------------ | ---------------------------------------- |
| `open`         | `boolean`                 | Not set            | Control whether chat is open.            |
| `defaultOpen`  | `boolean`                 | `false`            | Open chat on the first render.           |
| `onOpenChange` | `(open: boolean) => void` | Not set            | Receive open-state changes.              |
| `welcome`      | `WidgetWelcome`           | Workspace settings | Set the welcome message and suggestions. |

The dock also accepts `side`: `"left"` or `"right"`. The default is `"right"`.
Use a native button for the dock or modal `trigger`.

## Welcome content

```tsx
<CoristenWidget
  apiKey="coristen_pk_..."
  welcome={{
    message: "How can we help?",
    suggestions: [{ title: "Ask a question", message: "I have a question" }],
  }}
/>
```

Select a suggestion to send its `message`.
Use `suggestions: []` to hide the suggestions.
If you omit this option, Coristen uses the workspace suggestions.

## Appearance options

```tsx
<CoristenContactForm
  apiKey="coristen_pk_..."
  appearance={{ theme: "light", radius: "lg", showPoweredBy: true }}
/>
```

| Option                                            | Values                           | Applies to           |
| ------------------------------------------------- | -------------------------------- | -------------------- |
| `theme`                                           | `"default"`, `"light"`, `"dark"` | All widgets          |
| `radius`                                          | `"none"`, `"sm"`, `"md"`, `"lg"` | All widgets          |
| `showPoweredBy`                                   | `boolean`                        | All widgets          |
| `brandColor`                                      | CSS color                        | Chat                 |
| `tintedGrayscale`                                 | `boolean`                        | Chat                 |
| `accentEnabled`, `accentHeader`, `accentSendIcon` | `boolean`                        | Chat                 |
| `logoUrl`                                         | Image URL                        | Chat                 |
| `position`                                        | `"left"`, `"right"`              | Chat placement       |
| `bubbleIcon`, `bubbleImageUrl`, `bubbleColor`     | Icon name, image URL, CSS color  | Floating chat button |

Select `"default"` to use the website theme.
Use **Experiences > Contact form** to set the form title, description, and button label.

## Control chat from code

```tsx
import { coristenWidget } from "@coristen/widget"

coristenWidget.open()
coristenWidget.close()
coristenWidget.reset()
```

`open()` and `close()` control chat. They do not control form visibility.
Call `reset()` after sign-out to replace the widget session.
This function does not delete conversations.
