Use Cases
- Admin panels: Provide visual configuration and data management interfaces (e.g., FAQ management, analytics dashboards)
- Data displays: Show runtime statistics, logs, charts, etc.
- Interactive tools: Provide forms, editors, and other interactive interfaces

Adding a Page Component
Run the following command in the plugin directory:components/pages/:
manifest.yaml will also be updated with the component discovery config:
Manifest File: Page
Backend Handler
The Page component’s backend handler extends thePage base class and implements handle_api to process API requests from the frontend page.
PageRequest Fields
| Field | Type | Description |
|---|---|---|
endpoint | str | API endpoint path (e.g. '/entries') |
method | str | HTTP method (GET, POST, PUT, DELETE) |
body | Any | Request body (parsed JSON, or None) |
PageResponse Construction
| Method | Description |
|---|---|
PageResponse.ok(data) | Success response. data can be any JSON-serializable value |
PageResponse.fail(error) | Error response. error is a human-readable error string |
Frontend Page Development
Include the Page SDK in your HTML file to communicate with the plugin backend:Page SDK API
| Method | Description |
|---|---|
langbot.onReady(callback) | Fires when SDK is ready. callback receives ctx with theme and language |
langbot.api(endpoint, body?, method?) | Calls the plugin’s handle_api. Returns a Promise |
langbot.t(key, fallback?) | Gets a translated string |
langbot.onThemeChange(callback) | Fires when the theme changes |
langbot.onLanguageChange(callback) | Fires when the language changes |
langbot.applyI18n() | Manually re-apply data-i18n translations |
Dark Mode
The SDK automatically sets CSS custom properties on the page. Use them directly:| CSS Variable | Purpose |
|---|---|
--langbot-bg | Page background |
--langbot-bg-card | Card background |
--langbot-text | Primary text color |
--langbot-text-muted | Secondary text color |
--langbot-border | Border color |
--langbot-accent | Accent color |
Page i18n
Create ani18n/ directory inside your page directory with JSON translation files:
data-i18n attribute to HTML elements for automatic translation:
Full Example: FAQ Manager
Here is a complete Page component example that implements CRUD operations for FAQ entries. Backend handler (components/pages/manager/manager.py):
components/pages/manager/index.html) calls the backend via langbot.api():
Notes
- Pages run inside a
sandbox="allow-scripts allow-forms"iframe and cannot open popups or navigate the parent page - Access shared plugin state via
self.plugin— Page and Tool components can share data - Use
PageResponse.ok()andPageResponse.fail()to construct responses for consistent formatting - The Page SDK
<script>tag must be placed before any code that uses thelangbotobject
