Repository navigation
Styling and Theming
| Prop | Values | Effect |
|---|---|---|
variant |
pill (default), icon
|
Icon and label, or just the round WhatsApp icon. |
theme |
green (default), brand, light, dark, auto
|
See below. |
accentColor |
any CSS color | Launcher, header and button color. Overrides the theme. |
size |
sm, md (default), lg
|
Launcher size and text. |
position |
bottom-right (default), bottom-left, bottom-end, bottom-start
|
Corner of the screen. |
offset |
{ x, y } in pixels |
Distance from the screen edges. Default 16. |
zIndex |
number | Stacking order. Default 1000. |
greeting |
text | A bubble above the closed launcher, such as "Chat with us 👋". |
showNotificationDot |
true |
A red dot on the launcher until the widget is first opened. |
| Theme | Look |
|---|---|
green |
Dark green launcher and header, light panel. The default. |
brand |
Bright WhatsApp green with dark text. |
light |
White launcher with a green border; green header and buttons inside the panel. |
dark |
Dark launcher; the panel itself is dark, with bright green actions. |
auto |
Green launcher; the panel follows the visitor's light or dark setting (prefers-color-scheme). |
bottom-right and bottom-left always mean the physical corner. bottom-end and bottom-start follow the reading direction: in a right-to-left page bottom-end is the left corner. Use those two for sites that support both directions.
Set these on the widget (through style or className) or on any ancestor, such as :root:
| Variable | Controls | Default |
|---|---|---|
--wa-primary |
Launcher, header and button color | theme color |
--wa-bg |
Panel background |
#fff (dark: #14211e) |
--wa-text |
Panel text |
#152b27 (dark: #e8f1ee) |
--wa-radius |
Panel corner radius | .9rem |
--wa-z-index |
Stacking order | 1000 |
:root {
--wa-primary: #6d28d9;
--wa-radius: 1.25rem;
}<WhatsAppChat phoneNumber="+12025550123" style={{ '--wa-radius': '0.5rem' } as React.CSSProperties} />Precedence for the accent color: the accentColor prop wins, then --wa-primary, then the theme.
If you use your own accent color, check that the text on it is readable. The built-in themes meet WCAG AA contrast (at least 4.5:1) for text; a custom color is your responsibility.
All classes are prefixed wcr- and scoped under .wcr-widget:
| Class | Element |
|---|---|
.wcr-widget |
Root (the fixed-position container) |
.wcr-launcher |
The launcher button |
.wcr-panel |
The form panel |
.wcr-header, .wcr-body
|
Panel header band and body |
.wcr-form |
The form |
.wcr-agents, .wcr-agent
|
The agent picker and each agent card |
.wcr-status |
Online/offline status |
.wcr-offline |
Offline notice |
.wcr-primary |
Primary buttons (launcher and submit) |
Because the built-in rules start with .wcr-widget, override them with a rule of equal or higher specificity, for example .wcr-widget .wcr-launcher { font-size: 1rem; } placed after the widget's styles.
By default the widget injects one <style id="wcr-widget-styles"> element into the page head the first time it renders. To turn that off (for example under a strict Content Security Policy that blocks inline styles):
import 'whatsapp-chat-widget-react/styles.css';
<WhatsAppChat phoneNumber="+12025550123" injectStyles={false} />Import the stylesheet once, in your app entry point or root layout.