# Tutorial 3: Basic Form Patterns **Video Length**: ~20 minutes | **Difficulty**: Beginner | **Series**: Getting Started ## Overview Learn how to build user-friendly forms with validation using leptos-shadcn-ui form components. We'll create a registration form that demonstrates common patterns like controlled inputs, validation feedback, and form submission. ## What You'll Learn - Creating controlled form inputs with signals - Building form layouts with proper structure - Implementing client-side validation - Displaying validation errors and success messages - Handling form submission - Using form components: Input, Label, Button, Checkbox, Select ## Prerequisites - Completed [Tutorial 2: Your First Component](02-first-component.md) - Understanding of signals and event handlers ## Video Outline **[0:00]** Introduction to form patterns **[1:30]** Form component overview **[3:00]** Creating controlled inputs **[5:30]** Building a form layout **[8:00]** Adding validation rules **[11:00]** Displaying error messages **[13:30]** Handling form submission **[16:00]** Form accessibility best practices **[18:00]** Complete example walkthrough **[19:30]** Summary and next steps ## Step-by-Step Guide ### Understanding Controlled Inputs In Leptos, form inputs are "controlled" by signals: ```rust use leptos::*; use leptos_shadcn_input::Input; use leptos_shadcn_label::Label; #[component] pub fn ControlledInput() -> impl IntoView { let (value, set_value) = create_signal(String::new()); view! {
"You entered: " {value}
"Enter your information to get started"
{text.clone()}
} }) }} {move || { (!error.is_empty()).then(|| { view! {{error.clone()}
} }) }}