Leptos Components
A production-ready UI component library for Leptos applications.
Features
- 🚀 Production-ready components with sensible defaults
- 🎯 Type-safe props using Leptos's component system
- 📦 Tree-shakeable via Cargo feature flags
- 🌐 SSR/CSR compatible for full-stack applications
- ♿ Accessible following WCAG 2.1 guidelines
- 🎨 Themeable via CSS custom properties
Installation
Add to your Cargo.toml:
[]
= { = "0.1", = ["editor"] }
Quick Start
use *;
use Editor;
Available Components
Editor
A full-featured text editor with:
- Syntax highlighting (feature:
syntax-highlighting) - Line numbers
- Find & Replace (feature:
find-replace) - Undo/Redo
- Code folding (feature:
folding) - Document statistics (feature:
statistics)
<Editor
value=content
on_change=move |v| set_content.set
language="markdown"
show_line_numbers=true
word_wrap=true
tab_size=4
font_size=14.0
highlight_current_line=true
match_brackets=true
/>
Feature Flags
| Feature | Description |
|---|---|
editor |
Core text editor (default) |
syntax-highlighting |
Code syntax coloring |
markdown |
Markdown parsing and preview |
find-replace |
Search and replace |
folding |
Code folding |
statistics |
Word/character counts |
line-numbers |
Line number gutter |
minimap |
VS Code-style navigation |
editor-full |
All editor features |
ssr |
Server-side rendering |
hydrate |
Hydration support |
csr |
Client-side only |
Usage Examples
# Minimal editor
= { = "0.1", = ["editor"] }
# Full-featured editor
= { = "0.1", = ["editor-full"] }
# With SSR support
= { = "0.1", = ["editor", "ssr"] }
Styling
Components use CSS custom properties for easy theming:
}
/* Light theme */
}
Component Design Principles
All components follow these standards:
#[prop(into)]- Flexible input types- Optional props with defaults - Works with minimal config
classprop - Custom styling supportimpl IntoView- Standard Leptos return type- Controlled components - External state management
- Accessible by default - ARIA labels and keyboard support
Documentation
- Library Design - Architecture and standards
- Editor Design - Editor component details
- API Reference - Full API docs
- Examples - Code examples
Contributing
Contributions are welcome! Please read our contributing guidelines.
Development
# Run tests
# Check lints
# Format code
# Build docs
License
Licensed under MIT License.
Acknowledgments
- Built with Leptos
- Design system by ui-ux-pro-max