Customizing the Panel
The panel is the main UI that slides out from the side of the screen.
Basic Options
<PillarProviderproductKey="your-product-key"config={{panel: {enabled: true,position: 'right',mode: 'push',width: 380,},}}>
Options Reference
enabledtrue.position'right'.mode'push'.width380.containeruseShadowDOMfalse.hoverBreakpoint1200.hoverBackdroptrue.fullWidthBreakpoint500.initialOpenfalse.Panel Modes
Push Mode
Content shifts to make room for the panel:
panel: {mode: 'push',}
Best for applications where users interact with both the panel and main content.
Overlay Mode
Panel floats over the content:
panel: {mode: 'overlay',}
Best for minimal layouts or when panel content is the focus.
Responsive Behavior
On smaller screens, the panel automatically switches to overlay mode:
panel: {mode: 'push',hoverBreakpoint: 1200, // Switch to overlay below 1200pxhoverBackdrop: true, // Show backdrop when overlaying}
Disable responsive behavior:
panel: {hoverBreakpoint: false, // Always use push mode}
Resizing
Users can resize the panel by dragging its edge. The cursor changes to a resize indicator when hovering over the panel boundary. The resized width is automatically saved and restored across page loads.
<PillarProviderproductKey="your-product-key"config={{panel: {width: 450, // Default width in pixelsresizable: true, // Allow users to drag-resize (default)},}}>
Disable resizing if you want a fixed-width panel:
<PillarProviderproductKey="your-product-key"config={{panel: {width: 400,resizable: false, // Fixed-width panel, no drag handle},}}>
Custom Placement
Using a Container
Mount the panel to a specific element:
panel: {container: '#my-panel-container',}
Or pass an element reference:
const containerRef = useRef<HTMLDivElement>(null);<PillarProviderconfig={{panel: { container: containerRef.current }}}><div ref={containerRef} /></PillarProvider>
Manual Placement with PillarPanel
For full control over placement, use container: 'manual' with the PillarPanel component:
import { PillarProvider, PillarPanel } from '@pillar-ai/react';function App() {return (<PillarProviderproductKey="your-product-key"config={{ panel: { container: 'manual' } }}><div className="layout"><Sidebar /><main>Your content</main><PillarPanel className="custom-panel" /></div></PillarProvider>);}
Shadow DOM
By default, the panel inherits your app's CSS. Enable Shadow DOM for complete isolation:
panel: {useShadowDOM: true,}
When to use Shadow DOM:
- Embedding on third-party sites
- Avoiding CSS conflicts
- Ensuring consistent appearance
When to avoid Shadow DOM:
- Custom cards need your design system
- You want to style the panel with your CSS