Skip to main content

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

Authentication

Production embeds are authenticated with short-lived STS tokens minted by your backend — your long-lived API credential never reaches the browser. Your server exchanges its credential for a token scoped to a single element + end user, and hands the signed assertion to the SDK:
See Authentication & Tokens for how to mint and refresh tokens and the full security model.

Core Concepts

Elements

Elements are self-contained UI components that run in isolated contexts. 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

  1. Create - Initialize element with configuration
  2. Mount - Attach to DOM or open in modal
  3. Ready - Element is loaded and interactive
  4. Events - Ongoing communication with element
  5. Destroy - Clean up resources

Configuration

Elements accept configuration through the config parameter:

Display Options

DOM Mounting

Mount elements directly into existing DOM elements:
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


Need help? Check our troubleshooting guide or contact support.