3 releases (1 stable)
Uses new Rust 2024
1.0.0 | Apr 14, 2025 |
---|---|
0.2.0 | Apr 8, 2025 |
0.1.0 | Mar 2, 2025 |
#2583 in Procedural macros
79 downloads per month
Used in natrix
17KB
302 lines
Introduction

Natrix is a Rust-first frontend framework. Embracing Rust’s strengths—leveraging smart pointers, derive macros, the builder pattern, and other idiomatic Rust features to create a truly native experience.
A Simple Example
A simple counter in Natrix looks like this:
use natrix::prelude::*;
#[derive(Component)]
struct Counter(usize);
impl Component for Counter {
fn render() -> impl Element<Self> {
e::button()
.text(|ctx: R<Self>| *ctx.0)
.on::<events::Click>(|ctx: E<Self>, _, _| {
*ctx.0 += 1;
})
}
}
See the book for more information
Standout features
- ✅ No macro DSL – Macro-based DSLs break formatting & Rust Analyzer support. Natrix avoids them completely for a smoother dev experience.
- ✅ Derive macros for reactive state – No need for
useSignal
everywhere, define a struct, thats it. - ✅ Callbacks use references to state – Instead of closures capturing state setters, Natrix callbacks take a reference to the state, which better aligns with Rust’s ownership model.
- ✅ JS style bundling solution – Natrix has a compile time css and asset bundling solution that works with dependencies out of the box.
Design Goals
- Developer experience first – Natrix is designed to feel natural for Rust developers.
- Idiomatic Rust – We use Rust-native features & patterns, not what worked for js.
- Stop porting JS to Rust – Rust is an amazing language, let’s build a frontend framework that actually feels like Rust.
Dependencies
~13MB
~176K SLoC