Skip to content

Commit 6b0f809

Browse files
committed
docs: update banner plugin README and examples with CSS customization
- Add CSS customization section to plugins README - Update banner examples page with className and style props - Add customization examples for Tailwind and inline styles - Remove emoji from banner example - Link to full customization documentation
1 parent c5e46c0 commit 6b0f809

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

docs/pages/demo/banner.mdx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ experiences.register('welcome-banner', {
1717
url: { contains: '/' }
1818
},
1919
content: {
20-
title: '👋 Welcome!',
20+
title: 'Welcome!',
2121
message: 'Thanks for visiting our site',
2222
buttons: [
2323
{
@@ -115,6 +115,8 @@ const decisions = experiences.evaluateAll();
115115
| `buttons` | `array` | Array of button configurations |
116116
| `dismissable` | `boolean` | Can user dismiss? (default: `true`) |
117117
| `position` | `'top' \| 'bottom'` | Banner position (default: `'top'`) |
118+
| `className` | `string` | Custom CSS class for the banner |
119+
| `style` | `Record<string, string>` | Inline styles for the banner |
118120

119121
### Button Options
120122

@@ -125,6 +127,8 @@ buttons: [{
125127
url?: string; // Navigate on click
126128
variant?: 'primary' | 'secondary' | 'link'; // Visual style (default: 'primary')
127129
metadata?: Record<string, any>; // Custom metadata
130+
className?: string; // Custom CSS class
131+
style?: Record<string, string>; // Inline styles
128132
}]
129133
```
130134

@@ -159,6 +163,40 @@ targeting: {
159163
}
160164
```
161165

166+
## Customization
167+
168+
Customize banners with your own CSS using `className` or `style` props:
169+
170+
```typescript
171+
// With Tailwind classes
172+
experiences.register('promo', {
173+
type: 'banner',
174+
content: {
175+
message: 'Flash Sale: 50% Off!',
176+
className: 'bg-gradient-to-r from-blue-600 to-purple-600 text-white',
177+
buttons: [{
178+
text: 'Shop Now',
179+
className: 'bg-white text-blue-600 hover:bg-gray-100'
180+
}]
181+
}
182+
});
183+
184+
// With inline styles
185+
experiences.register('custom', {
186+
type: 'banner',
187+
content: {
188+
message: 'Custom styled banner',
189+
style: {
190+
background: 'linear-gradient(90deg, #667eea 0%, #764ba2 100%)',
191+
color: 'white',
192+
padding: '24px'
193+
}
194+
}
195+
});
196+
```
197+
198+
The banner plugin uses stable `.xp-*` CSS classes that you can target in your stylesheets. See the [Plugins documentation](/reference/plugins#customization) for complete customization guide.
199+
162200
## Events
163201

164202
Listen to banner interactions:

packages/plugins/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Renders banner experiences in the DOM with automatic positioning, theming, and r
1616
- Automatic theme detection (light/dark mode)
1717
- Top/bottom positioning
1818
- Dismissable with close button
19+
- **CSS customization** via `className` and `style` props
20+
- Stable `.xp-*` CSS classes for styling
1921

2022
```typescript
2123
import { createInstance, bannerPlugin } from '@prosdevlab/experience-sdk-plugins';
@@ -38,6 +40,33 @@ sdk.banner.show({
3840
});
3941
```
4042

43+
**Customization:**
44+
45+
The banner plugin uses `.xp-*` CSS classes and supports custom styling:
46+
47+
```typescript
48+
// With Tailwind
49+
content: {
50+
message: 'Flash Sale!',
51+
className: 'bg-gradient-to-r from-blue-600 to-purple-600 text-white',
52+
buttons: [{
53+
text: 'Shop Now',
54+
className: 'bg-white text-blue-600 hover:bg-gray-100'
55+
}]
56+
}
57+
58+
// With inline styles
59+
content: {
60+
message: 'Flash Sale!',
61+
style: {
62+
background: 'linear-gradient(90deg, #667eea 0%, #764ba2 100%)',
63+
color: 'white'
64+
}
65+
}
66+
```
67+
68+
See the [Plugins documentation](https://prosdevlab.github.io/experience-sdk/reference/plugins#customization) for more customization examples.
69+
4170
### Frequency Plugin
4271

4372
Manages impression tracking and frequency capping with persistent storage.

0 commit comments

Comments
 (0)