form: Fix label text wrapping issue (#1034)
| Before | After | | - | - | | <img width="752" alt="image" src="https://github.com/user-attachments/assets/32abd11a-39c6-4045-9727-3188c46e482c" /> | <img width="752" alt="image" src="https://github.com/user-attachments/assets/98e45484-1c05-4d90-977f-efd9b89d9dd9" /> |
This commit is contained in:
parent
51f36e1256
commit
f4025a9447
2 changed files with 10 additions and 6 deletions
|
|
@ -183,7 +183,7 @@ impl Render for FormStory {
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
form_field()
|
form_field()
|
||||||
.label("Birthday")
|
.label("Please select your birthday")
|
||||||
.child(DatePicker::new(&self.date))
|
.child(DatePicker::new(&self.date))
|
||||||
.description("Select your birthday, we will send you a gift."),
|
.description("Select your birthday, we will send you a gift."),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -378,14 +378,18 @@ impl RenderOnce for FormField {
|
||||||
.items_center()
|
.items_center()
|
||||||
.when_some(self.label, |this, builder| {
|
.when_some(self.label, |this, builder| {
|
||||||
this.child(
|
this.child(
|
||||||
h_flex().gap_1().child(builder.render(window, cx)).when(
|
h_flex()
|
||||||
self.required,
|
.gap_1()
|
||||||
|this| {
|
.child(
|
||||||
|
div()
|
||||||
|
.overflow_x_hidden()
|
||||||
|
.child(builder.render(window, cx)),
|
||||||
|
)
|
||||||
|
.when(self.required, |this| {
|
||||||
this.child(
|
this.child(
|
||||||
div().text_color(cx.theme().danger).child("*"),
|
div().text_color(cx.theme().danger).child("*"),
|
||||||
)
|
)
|
||||||
},
|
}),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue