Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
HyperChad
A template-based UI framework for building cross-platform applications with a unified codebase. HyperChad enables developers to write UI templates once and deploy across desktop (Egui, FLTK), web (HTML, Vanilla JS), and server-side (Actix, Lambda) environments.
Features
- Multi-Renderer Architecture: Support for Egui, FLTK, HTML, Vanilla JS, and server-side rendering
- Template-Based UI: Build interfaces using the
container!macro system - Routing System: Async router with navigation support
- Action System: Event handling and data flow management
- State Persistence: Key-value state store with optional SQLite persistence
- Color Management: Consistent theming across all renderers
- JavaScript Bundling: Automatic bundling for web deployments
- Responsive Design: Responsive triggers for adaptive layouts
- Cross-Platform: Desktop, web, and server applications from single codebase
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage
Basic Application
use ;
use ;
use container;
async
Template System
HyperChad uses a template macro system for building UIs:
use container;
let ui = container! ;
Routing
use ;
let router = new
.with_route
.with_route
.with_route;
State Management
HyperChad provides a simple key-value state store:
use ;
use json;
let state = new;
// Set values
state.set.await?;
state.set.await?;
// Get values
if let Some = state..await?
// With SQLite file persistence (requires "state-sqlite" feature)
Action System
// Define actions in templates using the fx DSL
let ui = container! ;
// Actions support conditionals and logic (with "actions-logic" feature)
let ui = container! ;
Programming Interface
Core Types
// Container - the fundamental building block
// Element - defines HTML/UI element types
Renderer Trait
use async_trait;
Application Builder
Configuration
Feature Flags
[]
= ["all"]
# Renderer features
= ["hyperchad_renderer_egui"]
= ["hyperchad_renderer_fltk"]
= ["hyperchad_renderer_html"]
= ["hyperchad_renderer_vanilla_js"]
# Platform features
= ["hyperchad_renderer_html_actix"]
= ["hyperchad_renderer_html_lambda"]
= ["hyperchad_renderer_html_web_server"]
# State features
= ["hyperchad_state"]
= ["hyperchad_state/persistence-sqlite"]
# Development features
= ["hyperchad_actions/logic"]
= ["hyperchad_renderer_egui/debug"]
= ["hyperchad_app/debug", "renderer-egui-debug", "renderer-fltk-debug"]
Renderer-Specific Usage
HyperChad supports multiple renderers through the AppBuilder. Use build_default() to automatically select the appropriate renderer based on enabled features, or use renderer-specific build methods:
use AppBuilder;
// Build with default renderer (based on features)
let app = new
.with_title
.with_router
.build_default?;
// Or use renderer-specific methods when available:
// - build_egui(renderer) for Egui desktop apps
// - build_fltk(renderer) for FLTK desktop apps
// - build_html(renderer) for HTML rendering
// See the renderer module documentation for specific usage
App Runtime Commands
App::run() dispatches to subcommands. Use one of these when running your binary:
# Start serving the application
# Generate static output (optional custom directory)
# Clean generated output (optional custom directory)
# Print dynamic routes
Testing
# Run all tests
# Test specific renderer
# Test with all renderers
Error Handling
Each module provides its own error types:
use ;
use Error as StateError;
use ParseError;
// App errors
match app.run
// State errors
match state..await
Architecture
HyperChad is built on these core concepts:
- Templates: Use the
container!macro to define UI structure - Containers: Styled elements that form the UI tree
- Renderers: Transform containers into platform-specific output
- Router: Maps paths to content generators (async closures)
- Actions: Handle events and trigger state changes or navigation
- State: Optional key-value persistence layer
See Also
hyperchad_app- Application builder and runtimehyperchad_renderer- Base renderer traithyperchad_renderer_egui- Egui desktop renderer implementationhyperchad_renderer_fltk- FLTK desktop renderer implementationhyperchad_renderer_html- HTML server-side rendererhyperchad_renderer_vanilla_js- Client-side JavaScript rendererhyperchad_state- State persistence systemhyperchad_router- Routing functionalityhyperchad_template- Template macro systemhyperchad_actions- Action system for eventshyperchad_color- Color managementhyperchad_transformer- Container and element types