Leptos UI
Macros to build UI components easily with Leptos and Tailwind CSS. Built on top of tw_merge.
Features
clx!macro for creating components with merged Tailwind classesa!macro for creating anchor elements with merged Tailwind classesdiv!macro for creating components without childreninput!macro for creating input elements with merged Tailwind classestransition!macro for creating components with "view-transition-name:*"
Example in Production
This crate is used in rust-ui.com — check it out to see Leptos UI and Tailwind CSS in action :)
Usage
Basic Component with clx!
// components/ui/card.rs
use *;
use clx;
pub use *;
// components/demos/demo_card.rs
Installation
Add this to your Cargo.toml:
[]
= "0.1"
P.S.: Don't forget to regularly run cargo update (frequent updates)!
Changelog
September 2025 - leptos_ui v0.2 Breaking Changes
We refactored the leptos_ui crate with breaking changes.
New macro system:
clx!: Elements with childrenvoid!: Self-closing elements (no children)
See MDN Docs for reference about void elements.
Attribute changes: Removed direct props from macros. Use attr:* and prop:* pattern instead:
// Define component
void!
// Before
<MyInput value=move || url.to_string readonly=true class="flex-1" />
// After
<MyInput prop:value=move || url.to_string attr:readonly=true class="flex-1" />
License
This project is licensed under the MIT License. See the LICENSE file for details.