Getting Started

Prerequisites

  • Rust toolchain (stable, 2021 edition)
  • Trunk for building and serving WASM apps
  • The wasm32-unknown-unknown target
rustup target add wasm32-unknown-unknown
cargo install trunk

Quick start

Leptos
Vanilla JS
Dioxus
Yew

Add rs-grid-leptos to your Cargo.toml:

Cargo.toml
[dependencies]
rs-grid-leptos = { path = "../rs-grid-leptos" }

Import the component and mount it inside a Leptos view:

src/main.rs
use leptos::*;
use rs_grid_leptos::GridCanvas;

#[component]
pub fn App() -> impl IntoView {
    view! {
        <main style="width: 100vw; height: 100vh;">
            <GridCanvas
                rows=1_000_000_u64
                cols=50_usize
            />
        </main>
    }
}

fn main() {
    leptos::mount_to_body(App);
}

Run the example:

cd examples/basic-leptos
trunk serve

Open http://localhost:8080 in your browser. You should see a grid rendering 1 million rows at 60 fps.

Build for production

cd examples/basic-leptos
trunk build --release

The output goes into dist/. Serve it with any static file server or use the provided Docker image.

Workspace commands

CommandDescription
cargo check --workspaceQuick type-check of all crates
cargo test --workspaceRun all unit tests
cargo fmt --allFormat the entire workspace
cargo clippy --workspace -- -D warningsLint with warnings as errors
trunk serve (in example dir)Dev server with hot reload
Tip

rs-grid-core has no WASM dependency — its unit tests run with plain cargo test, no browser needed.