Styles API
Customize the appearance and positioning of the Alhena chat widget using the Styles API.
The Alhena Widget SDK provides extensive styling options to customize the chat widget's appearance, positioning, and behavior to match your website's design.
Overview
You can configure widget styles in two ways:
Initial configuration - Set styles when the widget loads via
document.gleenConfig.stylesDynamic updates - Change styles at runtime using
window.gleenWidget.setStyles()
Quick Reference
widget_position
string
'RIGHT'
Widget placement: 'RIGHT', 'LEFT', or 'CENTER'
bottom_spacing
number
0
Distance from bottom of viewport (px)
left_spacing
number
0
Distance from left edge (px)
right_spacing
number
0
Distance from right edge (px)
mobile_bottom_spacing
number
0
Bottom spacing on mobile (px)
mobile_left_spacing
number
0
Left spacing on mobile (px)
mobile_right_spacing
number
0
Right spacing on mobile (px)
use_same_position_for_mobile
boolean
false
Use desktop spacing on mobile
widget_border_radius
number
0
Border radius of chat window (px)
widget_width
number
0
Width of chat window (px)
widget_background_color
string
'#fff'
Background color (CSS color)
z_index
number
200000
Z-index for chat window
launcher_z_index
number
200000
Z-index for launcher button
fontFamily
string
(auto)
Custom font family
setStyles(styles)
Dynamically updates the widget's visual appearance and positioning after initialization. The provided styles are merged with existing configuration.
Style Properties
Positioning
Control where the widget appears on the page.
widget_position
Sets the horizontal placement of the widget.
'RIGHT'
Aligns widget to the right side (default)
'LEFT'
Aligns widget to the left side
'CENTER'
Centers the widget horizontally
bottom_spacing
Distance in pixels from the bottom of the viewport. Use this to position the widget above other fixed elements like cookie banners.
left_spacing
Distance in pixels from the left edge of the viewport. Only applies when widget_position is 'LEFT'.
right_spacing
Distance in pixels from the right edge of the viewport. Only applies when widget_position is 'RIGHT'.
Mobile-Specific Positioning
Override positioning values specifically for mobile devices.
mobile_bottom_spacing
Bottom spacing override for mobile devices. Useful for avoiding overlap with mobile navigation bars.
mobile_left_spacing
Left spacing override for mobile devices.
mobile_right_spacing
Right spacing override for mobile devices.
use_same_position_for_mobile
When true, uses desktop spacing values on mobile instead of mobile-specific overrides.
Visual Styling
Customize the widget's appearance.
widget_border_radius
Border radius of the chat window in pixels. Use this to match your site's design language.
widget_width
Width of the chat window in pixels. When set to 0, uses the default width.
widget_background_color
Background color of the chat window. Accepts any valid CSS color value.
Layering (Z-Index)
Control the stacking order of widget elements.
z_index
Z-index for the chat window. Increase this if the widget appears behind other elements.
launcher_z_index
Z-index specifically for the launcher button. Falls back to z_index if not specified.
Typography
Customize the widget's fonts.
fontFamily
Custom font family for the chat widget. Accepts any valid CSS font-family value.
If not specified, the widget uses:
Your organization's configured font (from dashboard settings)
Falls back to
'Nunito, sans-serif'
Initial Configuration
Set styles during initialization by including them in document.gleenConfig.styles:
This is useful for overriding dashboard settings on specific pages.
Dynamic Updates
Update styles at runtime using setStyles(). Styles are merged with existing values:
Complete Example
Common Use Cases
Avoid Overlap with Cookie Banner
Match Brand Design
Mobile-Optimized Layout
Ensure Widget Visibility
Related Resources
JavaScript API - Complete method reference
Custom Data - Passing user data to the widget
Examples - Code examples for common use cases
Last updated