leptos-forms-rs 0.2.0

Type-safe, reactive form handling library for Leptos applications
Documentation

Leptos Forms RS

A type-safe, reactive form handling library for Leptos applications.

Quick Start

use leptos::*;
use leptos_forms_rs::*;

#[derive(Form, Clone, Serialize, Deserialize)]
struct LoginForm {
    #[form(required, email)]
    email: String,
    #[form(required, min_length = 8)]
    password: String,
    #[form(default = true)]
    remember_me: bool,
}

#[component]
fn LoginPage() -> impl IntoView {
    let form = use_form::<LoginForm>();
    
    view! {
        <Form form=form>
            <FormField name="email" />
            <FormField name="password" input_type="password" />
            <FormField name="remember_me" />
            <button type="submit">"Login"</button>
        </Form>
    }
}

Features

  • Type-safe forms with compile-time validation
  • Reactive state management with Leptos signals
  • Built-in validation with customizable rules
  • Form persistence with localStorage support
  • Accessibility with proper ARIA attributes
  • Mobile-friendly with touch event handling