Widget Configuration
Customize the LILA chat widget appearance and behavior. This page covers every configuration option available. Change the position, theme, size, and authentication mode to match your application’s design and security requirements.
Basic Configuration
The minimum configuration requires your API key and JWT token:
<script type="module" src="https://embed.getlila.one/loader.js"></script>
<lila-widget
api-key="your-api-key"
jwt-token="your-jwt-token">
</lila-widget>
All Configuration Attributes
Complete attribute reference for the LILA widget.
Authentication
Choose either JWT authentication or basic authentication.
JWT Authentication (Production)
Required attributes:
| Attribute | Type | Description |
|---|---|---|
api-key | string | Your LILA API key from the Dashboard |
jwt-token | string | Server-generated JWT token |
User details (user_id, role, email, name, tenant_id) are extracted from the JWT payload.
Basic Authentication (Development/Testing)
Required attributes:
| Attribute | Type | Description |
|---|---|---|
api-key | string | Your LILA API key from the Dashboard |
user-id | string | External user identifier |
Optional attributes:
| Attribute | Type | Default | Description |
|---|---|---|---|
user-role | string | user | User role (e.g., user, admin, customer) |
user-email | string | - | User email address |
user-name | string | - | User display name |
tenant-id | string | - | For multi-tenant applications |
Note: JWT authentication is recommended for production. Basic authentication is suitable for testing and development.
Appearance & Layout
| Attribute | Type | Default | Description |
|---|---|---|---|
position | left | right | right | Widget launcher position on screen |
drawer-mode | left | right | bottom | right | Direction sessions drawer slides from |
theme | light | dark | Auto-detect | Color theme (auto-detects from system preference) |
width | string | 400px | Widget width (any CSS value) |
height | string | 95dvh | Widget height (any CSS value) |
Configuration Examples
Minimal Setup (Testing)
<lila-widget
api-key="your-api-key"
user-id="test-user">
</lila-widget>
Basic Authentication with User Details
<lila-widget
api-key="your-api-key"
user-id="user_12345"
user-role="customer"
user-email="[email protected]"
user-name="John Doe">
</lila-widget>
JWT Authentication (Production)
<lila-widget
api-key="your-api-key"
jwt-token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...">
</lila-widget>
The JWT token should include user information in the payload:
{
"user_id": "user_12345",
"user_role": "customer",
"user_email": "[email protected]",
"user_name": "John Doe"
}
See JWT Authentication Guide for complete implementation details including token generation examples.
Custom Position & Drawer
<!-- Widget on right, drawer slides from left -->
<lila-widget
api-key="your-api-key"
position="right"
drawer-mode="left">
</lila-widget>
<!-- Widget on left, drawer slides from bottom -->
<lila-widget
api-key="your-api-key"
position="left"
drawer-mode="bottom">
</lila-widget>
Dark Theme
<lila-widget
api-key="your-api-key"
theme="dark">
</lila-widget>
Custom Size
<lila-widget
api-key="your-api-key"
width="500px"
height="700px">
</lila-widget>
Full Configuration Example
<lila-widget
api-key="your-api-key"
jwt-token="<?php echo $jwtToken; ?>"
position="right"
drawer-mode="right"
theme="light"
width="450px"
height="90vh">
</lila-widget>
Understanding Position vs Drawer Mode
Position and drawer-mode control different aspects of the widget:
Position (left or right)
Controls where the widget launcher appears on the page:
left- Launcher appears in bottom-left cornerright- Launcher appears in bottom-right corner
Drawer Mode (left, right, or bottom)
Controls where the sessions drawer slides from when opened:
left- Drawer slides in from the left sideright- Drawer slides in from the right sidebottom- Drawer slides up from the bottom
Common Combinations:
<!-- Widget on right, drawer from right (default feel) -->
<lila-widget position="right" drawer-mode="right"></lila-widget>
<!-- Widget on left, drawer from left (mirrored) -->
<lila-widget position="left" drawer-mode="left"></lila-widget>
<!-- Widget on right, drawer from bottom (mobile-like) -->
<lila-widget position="right" drawer-mode="bottom"></lila-widget>
JavaScript API
Dynamic Configuration Updates
Update widget attributes dynamically using standard Web Components API:
const widget = document.querySelector('lila-widget');
// Update theme
widget.setAttribute('theme', 'dark');
// Update JWT token (for session refresh)
widget.setAttribute('jwt-token', newToken);
// Update drawer mode
widget.setAttribute('drawer-mode', 'bottom');
Security Best Practices
API Key Protection
- ✅ API keys can be safely exposed in frontend code
- ✅ Rate limiting and domain restrictions are enforced server-side
- ❌ Never commit API keys to public repositories
Configure allowed domains in your Dashboard → Project Settings → Security.
JWT Authentication
For production environments with user authentication, generate JWT tokens server-side and pass them to the widget:
<lila-widget
api-key="your-api-key"
jwt-token="<?php echo $jwtToken; ?>">
</lila-widget>
Complete JWT implementation guides:
- JWT Authentication Overview - Security concepts and best practices
- JWT with JavaScript - Node.js and frontend implementation
- JWT with PHP - PHP and Laravel implementation
These guides cover token generation, payload structure, and security best practices.
Troubleshooting
LILA widget troubleshooting. Check these common issues.
Widget Not Loading
- Check browser console for errors
- Verify API key is correct
- Ensure script tag is loaded:
<script type="module" src="https://embed.getlila.one/loader.js"></script> - Check network tab for blocked requests
- Verify your domain is whitelisted in Dashboard settings
Authentication Errors
JWT Authentication:
- Verify JWT token is valid and not expired
- Check JWT secret matches project settings in Dashboard
- Ensure token payload includes required fields (
user_id)
Basic Authentication:
- Verify
user-idattribute is set correctly - Check browser console for connection errors
Sessions Not Persisting
- Verify user_id is consistent across page loads
- Check browser console for WebSocket connection errors
- Ensure cookies/localStorage are enabled
Drawer Not Opening
- Check that drawer-mode attribute is valid (
left,right, orbottom) - Verify no JavaScript errors in console
- Try different drawer-mode values
- Check for conflicting z-index CSS on your page
Keyboard Shortcuts
The widget supports these keyboard shortcuts:
- ESC - Close settings panel or rename input (if active), then close drawer
- Enter - Send message (in chat input) or save session rename
Responsive Behavior
The widget automatically adapts to mobile screens:
- Desktop: Full width/height as configured
- Mobile: Expands to fit available screen space
- Drawer modes: Bottom drawer recommended for mobile devices
Next Steps
- Quick Start Guide - Get widget running in 2 minutes
- HTML Integration - Advanced JavaScript integration
- WordPress Guide - WooCommerce integration
- Laravel Guide - PHP/Laravel with JWT
- Authentication - Secure JWT implementation