githubEdit

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:

  1. Initial configuration - Set styles when the widget loads via document.gleenConfig.styles

  2. Dynamic updates - Change styles at runtime using window.gleenWidget.setStyles()


Quick Reference

Property
Type
Default
Description

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.

Value
Description

'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.

circle-exclamation

If not specified, the widget uses:

  1. Your organization's configured font (from dashboard settings)

  2. 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

Match Brand Design

Mobile-Optimized Layout

Ensure Widget Visibility


Last updated