|
| 1 | +# claudius-chat-widget |
| 2 | + |
| 3 | +[](https://www.npmjs.com/package/claudius-chat-widget) |
| 4 | +[](https://github.com/PMDevSolutions/Claudius/blob/main/LICENSE) |
| 5 | + |
| 6 | +Embeddable AI chat widget powered by Claude. Drop it into any React app as a |
| 7 | +component, or use the standalone script embed on any website. |
| 8 | + |
| 9 | +**Full documentation: [claudius-docs.pages.dev](https://claudius-docs.pages.dev)** |
| 10 | + |
| 11 | +> Claudius is two pieces: a **Cloudflare Worker** that keeps your Anthropic API |
| 12 | +> key server-side, and this **widget**. You point the widget at your deployed |
| 13 | +> worker via `apiUrl`. See the |
| 14 | +> [worker setup guide](https://claudius-docs.pages.dev/deployment/worker/) to |
| 15 | +> stand up the backend first. |
| 16 | +
|
| 17 | +## Install |
| 18 | + |
| 19 | +```bash |
| 20 | +npm install claudius-chat-widget react react-dom |
| 21 | +``` |
| 22 | + |
| 23 | +`react` and `react-dom` (v18 or v19) are peer dependencies — install them |
| 24 | +alongside the widget. |
| 25 | + |
| 26 | +## Usage |
| 27 | + |
| 28 | +```tsx |
| 29 | +import { ChatWidget } from "claudius-chat-widget"; |
| 30 | +import "claudius-chat-widget/style.css"; |
| 31 | + |
| 32 | +export function App() { |
| 33 | + return ( |
| 34 | + <ChatWidget |
| 35 | + apiUrl="https://claudius-chat-worker.<you>.workers.dev" |
| 36 | + title="Support" |
| 37 | + subtitle="Ask me anything" |
| 38 | + theme="auto" |
| 39 | + /> |
| 40 | + ); |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | +Import the stylesheet **once** anywhere in your app (it ships separately so |
| 45 | +bundlers can tree-shake the component when unused). |
| 46 | + |
| 47 | +### Common props |
| 48 | + |
| 49 | +| Prop | Type | Required | Description | |
| 50 | +| ---------- | -------------------- | -------- | -------------------------------------------- | |
| 51 | +| `apiUrl` | `string` | Yes | URL of your deployed Claudius worker. | |
| 52 | +| `title` | `string` | No | Header title shown in the chat window. | |
| 53 | +| `subtitle` | `string` | No | Header subtitle / tagline. | |
| 54 | +| `theme` | `ClaudiusThemeInput` | No | `"auto"`, a built-in theme name, or a custom token object. | |
| 55 | +| `position` | `WidgetPosition` | No | Corner the launcher docks to. | |
| 56 | + |
| 57 | +The full prop set is exported as the `ChatWidgetProps` type. See the |
| 58 | +[configuration docs](https://claudius-docs.pages.dev/configuration/widget/) for |
| 59 | +triggers, localization, and theming. |
| 60 | + |
| 61 | +## Exports |
| 62 | + |
| 63 | +- `claudius-chat-widget` — the `ChatWidget` component plus theming, i18n, and the |
| 64 | + typed `ChatApiClient`. Ships dual **ESM** (`import`) and **CommonJS** |
| 65 | + (`require`) builds with TypeScript declarations. |
| 66 | +- `claudius-chat-widget/style.css` — the widget stylesheet. |
| 67 | +- `claudius-chat-widget/embed` — the prebuilt IIFE bundle for `<script>` usage. |
| 68 | + |
| 69 | +## Standalone script embed (no build step) |
| 70 | + |
| 71 | +Prefer a single `<script>` tag? Use the CDN channel instead of npm: |
| 72 | + |
| 73 | +```html |
| 74 | +<script> |
| 75 | + window.ClaudiusConfig = { |
| 76 | + apiUrl: "https://claudius-chat-worker.<you>.workers.dev", |
| 77 | + title: "Support", |
| 78 | + }; |
| 79 | +</script> |
| 80 | +<link |
| 81 | + rel="stylesheet" |
| 82 | + href="https://cdn.jsdelivr.net/gh/PMDevSolutions/Claudius@1/cdn/claudius.css" |
| 83 | +/> |
| 84 | +<script src="https://cdn.jsdelivr.net/gh/PMDevSolutions/Claudius@1/cdn/claudius.iife.js"></script> |
| 85 | +``` |
| 86 | + |
| 87 | +## License |
| 88 | + |
| 89 | +MIT © PMDevSolutions. See [LICENSE](./LICENSE). |
0 commit comments