Allow icon in form input component
Misc style adjustments
This commit is contained in:
@@ -9,20 +9,25 @@ pub fn FormInput(
|
|||||||
#[props(default)] name: Option<String>,
|
#[props(default)] name: Option<String>,
|
||||||
#[props(default)] required: bool,
|
#[props(default)] required: bool,
|
||||||
#[props(default)] r#type: String,
|
#[props(default)] r#type: String,
|
||||||
|
children: Element,
|
||||||
) -> Element {
|
) -> Element {
|
||||||
let name = name.unwrap_or(label.to_lowercase());
|
let name = name.unwrap_or(label.to_lowercase());
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
div {
|
div {
|
||||||
class: "group",
|
class: "group/field",
|
||||||
|
|
||||||
label {
|
p {
|
||||||
class: "label opacity-0 not-group-has-placeholder-shown:opacity-100 transition-opacity pl-2",
|
class: "opacity-0 not-group-has-placeholder-shown/field:opacity-70 transition-opacity pl-2",
|
||||||
{label.clone()}
|
{label.clone()}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
class: "input w-full",
|
||||||
|
|
||||||
|
{children}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
class: "input",
|
|
||||||
name,
|
name,
|
||||||
required,
|
required,
|
||||||
r#type,
|
r#type,
|
||||||
@@ -31,3 +36,4 @@ pub fn FormInput(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user