diff options
author | 2020-12-01 11:52:52 +0100 | |
---|---|---|
committer | 2021-06-10 18:28:37 +0700 | |
commit | dbc1181011d579ac1da2546fba08e11094633f4b (patch) | |
tree | 1b5239b76f4040b02bf73cd2b4cf8d88507e1bef /native | |
parent | 0e70b11e00e4d8517419a5f09490c9502827d35b (diff) | |
download | iced-dbc1181011d579ac1da2546fba08e11094633f4b.tar.gz iced-dbc1181011d579ac1da2546fba08e11094633f4b.tar.bz2 iced-dbc1181011d579ac1da2546fba08e11094633f4b.zip |
Adds doc comment for disabled button
Makes disabled button behavior consistent in web
Diffstat (limited to 'native')
-rw-r--r-- | native/src/widget/button.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs index f61c22d0..c9b9df58 100644 --- a/native/src/widget/button.rs +++ b/native/src/widget/button.rs @@ -29,6 +29,13 @@ use std::hash::Hash; /// let button = Button::new(&mut state, Text::new("Press me!")) /// .on_press(Message::ButtonPressed); /// ``` +/// +/// Buttons can be disabled by not having an on_press. +/// +/// ``` +/// let mut state = button::State::new(); +/// let disabled_button = Button::new(&mut state, Text::new("I'm disabled!")); +/// ``` #[allow(missing_debug_implementations)] pub struct Button<'a, Message, Renderer: self::Renderer> { state: &'a mut State, @@ -97,6 +104,7 @@ where } /// Sets the message that will be produced when the [`Button`] is pressed. + /// If on_press isn't set, button will be disabled. pub fn on_press(mut self, msg: Message) -> Self { self.on_press = Some(msg); self |