leptos-forms-rs 1.3.0

🚀 Type-safe, reactive form handling library for Leptos applications. Production-ready with 100% test success rate, cross-browser compatibility, and comprehensive validation. Built with Rust/WASM for high performance.
Documentation
//! FormReset component
//!
//! This module provides the FormReset component for resetting forms.

use crate::core::*;
use crate::events::FormResetHandler;
use leptos::prelude::*;

/// FormReset component for resetting forms
#[component]
pub fn FormReset<T: Form + PartialEq + Clone + Send + Sync>(
    form: FormHandle<T>,
    #[prop(optional)] class: Option<String>,
    #[prop(optional)] confirm_message: Option<String>,
    children: Option<Children>,
) -> impl IntoView {
    let button_class = class.unwrap_or_else(|| "form-reset".to_string());
    let confirm_message =
        confirm_message.unwrap_or_else(|| "Are you sure you want to reset the form?".to_string());

    // Create the reset handler using the event system
    let reset_handler =
        FormResetHandler::new(form.clone()).with_confirmation(confirm_message.clone());

    view! {
        <button
            type="button"
            class=button_class
            on:click=reset_handler.handle_reset()
        >
            {if let Some(children) = children { children() } else { view! { <span></span> }.into_any() }}
        </button>
    }
}