summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-06 01:26:08 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-06 01:26:08 +0100
commite953733323c1c2a50cc511408167c7982f84bf06 (patch)
tree202ac208c377faba77b24b9f6af5bff9da77fd81 /web
parent8e83f3632c7b06370ce47d975750313a56221d28 (diff)
downloadiced-e953733323c1c2a50cc511408167c7982f84bf06.tar.gz
iced-e953733323c1c2a50cc511408167c7982f84bf06.tar.bz2
iced-e953733323c1c2a50cc511408167c7982f84bf06.zip
Add style to `TextInput` in `iced_web`
Diffstat (limited to 'web')
-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>