From 819161ec586a4f7dd1f99b56758044ecbd8520e8 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Wed, 25 Jun 2025 22:30:09 +0800 Subject: [PATCH] form: Fix form label required not in same line. (#1013) ![image](https://github.com/user-attachments/assets/2435e099-4d92-4a52-a825-d7b23e27e5d1) --- crates/ui/src/form.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/ui/src/form.rs b/crates/ui/src/form.rs index 240af2fa..f136690f 100644 --- a/crates/ui/src/form.rs +++ b/crates/ui/src/form.rs @@ -377,13 +377,15 @@ impl RenderOnce for FormField { .gap_1() .items_center() .when_some(self.label, |this, builder| { - this.child(builder.render(window, cx)).when( - self.required, - |this| { - this.child( - div().text_color(cx.theme().danger).child("*"), - ) - }, + this.child( + h_flex().gap_1().child(builder.render(window, cx)).when( + self.required, + |this| { + this.child( + div().text_color(cx.theme().danger).child("*"), + ) + }, + ), ) }), )