summaryrefslogtreecommitdiffstats
path: root/web/src/widget/text_input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/widget/text_input.rs')
-rw-r--r--web/src/widget/text_input.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/web/src/widget/text_input.rs b/web/src/widget/text_input.rs
index 2b22b93f..c1034e43 100644
--- a/web/src/widget/text_input.rs
+++ b/web/src/widget/text_input.rs
@@ -42,6 +42,7 @@ pub struct TextInput<'a, Message> {
size: Option<u16>,
on_change: Rc<Box<dyn Fn(String) -> Message>>,
on_submit: Option<Message>,
+ style: Box<dyn StyleSheet>,
}
impl<'a, Message> TextInput<'a, Message> {
@@ -75,6 +76,7 @@ impl<'a, Message> TextInput<'a, Message> {
size: None,
on_change: Rc::new(Box::new(on_change)),
on_submit: None,
+ style: Default::default(),
}
}
@@ -126,6 +128,14 @@ impl<'a, Message> TextInput<'a, Message> {
self.on_submit = Some(message);
self
}
+
+ /// Sets the style of the [`TextInput`].
+ ///
+ /// [`TextInput`]: struct.TextInput.html
+ pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self {
+ self.style = style.into();
+ self
+ }
}
impl<'a, Message> Widget<Message> for TextInput<'a, Message>