# @netbirdio/explain
AI-powered "Explain" assistant for React apps. Users click on UI elements and get contextual AI explanations via a chat panel.
The package has two entry points:
- `@netbirdio/explain/client` — React components (provider, chat panel, floating button)
- `@netbirdio/explain/server` — Node.js handler that proxies requests to Anthropic or OpenAI
No CSS framework required — the package is fully self-contained with inline styles and CSS custom properties.
## Installation
```bash
npm install @netbirdio/explain
```
Peer dependencies: `react >=18`, `react-dom >=18`.
For local development as a workspace package, add it to your `package.json`:
```json
{
"dependencies": {
"@netbirdio/explain": "file:./packages/@netbirdio/explain"
}
}
```
If you're using Next.js, add to `next.config.js`:
```js
module.exports = {
transpilePackages: ["@netbirdio/explain"],
};
```
---
## Client
### Setup
Wrap your app with `AIAssistantProvider`:
```tsx
import { AIAssistantProvider } from "@netbirdio/explain/client";
export default function App({ children }) {
return (
{children}
);
}
```
This renders the floating action button and chat panel automatically. No CSS imports are needed — the provider injects all required styles via CSS custom properties.
### Props
| Prop | Type | Required | Description |
| ---------- | ----------- | -------- | ----------------------------------- |
| `endpoint` | `string` | Yes | URL of the AI chat API |
| `apiKey` | `string` | No | Bearer token sent with each request |
| `children` | `ReactNode` | Yes | Your application |
### Marking elements as explainable
Add the `data-nb-explain` attribute to any element you want users to be able to click on in explain mode:
```tsx
```
When clicked, the library extracts a label from the element (first `