From 283b319edd0a9cd60d3cb230fe8d747df9a9663b Mon Sep 17 00:00:00 2001 From: Floyd Wang Date: Fri, 9 Aug 2024 17:24:29 +0800 Subject: [PATCH] Input add `set_placeholder` method (#131) --- crates/ui/src/input/input.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/ui/src/input/input.rs b/crates/ui/src/input/input.rs index 2c3c0a10..096396e1 100644 --- a/crates/ui/src/input/input.rs +++ b/crates/ui/src/input/input.rs @@ -261,6 +261,11 @@ impl TextInput { self } + /// Set the placeholder text without ownership. + pub fn set_placeholder(&mut self, placeholder: impl Into) { + self.placeholder = placeholder.into(); + } + /// Set true to show the clear button when the input field is not empty. pub fn cleanable(mut self, cleanable: bool) -> Self { self.cleanable = cleanable;