Files
AobaV2/AobaClient/src/components/basic/input.rs
Amatsugu d0cc8be566 Added Auth Context
implement login client code (todo: server login)
Added aboa icon
2025-05-03 23:52:51 -04:00

31 lines
670 B
Rust

use dioxus::prelude::*;
#[derive(PartialEq, Clone, Props)]
pub struct InputProps {
pub r#type: Option<String>,
pub value: Option<Signal<String>>,
pub label: Option<String>,
pub placeholder: Option<String>,
pub name: String,
pub oninput: Option<EventHandler<FormEvent>>,
pub required: Option<bool>,
}
#[component]
pub fn Input(props: InputProps) -> Element {
let label = props.label.unwrap_or("".into());
let ph = props.placeholder.unwrap_or(label.clone());
rsx! {
label {
"{label}",
input {
type : props.r#type.unwrap_or("text".into()),
value: props.value,
name: props.name,
placeholder:ph,
required: props.required
}
}
}
}