Getting Started with SmarterElements
SmarterElements is a powerful system for embedding interactive UI components into web applications. Elements can be mounted directly into the DOM or displayed in modals with full isolation and automatic resizing.Installation
Quick Start
React Integration
JavaScript Integration
Core Concepts
Elements
Elements are self-contained UI components that run in isolated iframes. Each element has:- Type: A unique identifier (e.g.,
blockkit/renderer) - Configuration: Parameters passed to the element
- Events: Messages the element can send/receive
- Lifecycle: Methods for mounting, destroying, etc.
Element Lifecycle
- Create - Initialize element with configuration
- Mount - Attach to DOM or open in modal
- Ready - Element is loaded and interactive
- Events - Ongoing communication with element
- Destroy - Clean up resources
Configuration
Elements accept configuration through theconfig parameter:
Display Options
DOM Mounting
Mount elements directly into existing DOM elements:Modal Display
Display elements in overlay modals with automatic sizing:Event Handling
Elements can send events to the parent application:Error Handling
Handle element errors gracefully:Advanced Features
Auto-Resizing
Elements automatically resize based on their content. The modal system includes:- Content-driven sizing - Height adjusts to content
- Smooth transitions - Animated resize changes
- Performance optimization - Debounced resize updates
- Constraint handling - Respects min/max limits
Element Communication
Send messages to elements after they’re mounted:Multiple Elements
Manage multiple elements simultaneously:Best Practices
Performance
- Lazy loading - Only create elements when needed
- Proper cleanup - Always destroy elements when done
- Event management - Remove event listeners appropriately
Error Handling
- Graceful degradation - Handle element load failures
- User feedback - Show loading states and error messages
- Retry logic - Implement retry for transient failures
Accessibility
- Keyboard navigation - Elements support keyboard interaction
- Screen readers - Proper ARIA labels and roles
- Focus management - Modal focus trapping and restoration
Next Steps
- Browse the Element Reference for available elements
- Check out Examples for common use cases
- Read the API Reference for detailed method documentation
Need help? Check our troubleshooting guide or contact support.
