feat: create new header component

This component is now required for forms.
This commit is contained in:
alphafetus committed 2026-01-12 16:14:24 -05:00
1 parent 5d72a8f949
commit 14d89fc696
7 files changed
+76 -13

No files matched your search

+14 -2
View File
@@ -1,7 +1,7 @@
use leptos::logging::log;
use leptos::prelude::*;
use leptos::web_sys::SubmitEvent;
use crate::components::ActionButton;
use crate::components::{ActionButton, Header};
/// Indicates the current state of an input.
#[derive(Default, Debug, Clone)]
@@ -71,7 +71,11 @@ pub fn use_validation_context() -> Option<FormValidationRegistry> {
/// Example usage in the view macro:
/// ```
/// view! {
/// <ValidatedForm on_submit=Callback::new(move || {/* something here */})>
/// <ValidatedForm
/// on_submit=Callback::new(move || {/* something here */})
/// title="Example Title"
/// description="Example description."
/// >
/// {/* As many input components as you want */}
/// </ValidatedForm>
/// }
@@ -102,6 +106,10 @@ pub fn ValidatedForm(
children: Children,
/// A callback that runs when the form successfully validates.
#[prop(into)] on_submit: Callback<()>,
/// The title of the included header.
#[prop(into)] title: Signal<String>,
/// The description for the included header.
#[prop(optional, into)] description: Signal<String>,
) -> impl IntoView {
let validators = RwSignal::new(vec![]);
@@ -142,6 +150,10 @@ pub fn ValidatedForm(
view! {
<form novalidate on:submit=submit_success_event>
<Header
title=title
description=description
/>
{children()}
<ActionButton
on:click=move |_| {