Overview
Live interactive component embed for showcasing React components within slides. Keyboard navigation (arrow keys, space) is disabled while focus is inside the demo area so the embedded component can handle its own input. The container tracks its maximum height to prevent layout jumps when the child re-renders with different content sizes.Props
The interactive React component(s) to embed in the demo area.
Optional uppercase label shown above the demo area.
Additional CSS classes to apply to the wrapper element.
Usage Examples
Basic Demo
Form Component
Multiple Components
Without Label
Custom Styling
In Two-Column Layout
Keyboard Navigation
Interactive Mode
The demo area has adata-slide-interactive attribute that signals to the slide deck to disable keyboard navigation while focus is inside. This allows embedded components to:
- Use arrow keys for their own navigation
- Handle space bar for interactions (checkboxes, buttons)
- Prevent accidental slide transitions during interaction
Implementation Detail
TheSlideDeck component checks for focus within [data-slide-interactive] elements before processing keyboard shortcuts. When focus is inside a demo area, slide navigation is temporarily disabled.
Styling Details
Container Structure
Default Styles
- Wrapper:
max-w-2xlwidth constraint, full width on smaller screens - Label: Muted color, small text, uppercase with letter spacing
- Demo area: Light background (
bg-foreground/[0.03]), subtle border, responsive padding (p-4→p-6)
Height Tracking
The internalSlideDemoContent component uses a ref and effect to track the maximum height of the demo content, preventing layout shifts when content changes size:
Best Practices
State Management
Components insideSlideDemo maintain their state during slide transitions. For demos that should reset on each visit:
Performance
For complex interactive demos, consider lazy loading:Accessibility
Ensure embedded components are keyboard accessible:Related Components
- SlideCode - Show code examples alongside demos
- SlideColumns - Side-by-side code and demo layout
- Slide - Main slide container