diff options
Diffstat (limited to 'web/src/widget.rs')
-rw-r--r-- | web/src/widget.rs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/web/src/widget.rs b/web/src/widget.rs index 88b2efc9..30ac8eeb 100644 --- a/web/src/widget.rs +++ b/web/src/widget.rs @@ -1,15 +1,31 @@ +//! Use the built-in widgets or create your own. +//! +//! # Custom widgets +//! If you want to implement a custom widget, you simply need to implement the +//! [`Widget`] trait. You can use the API of the built-in widgets as a guide or +//! source of inspiration. +//! +//! # Re-exports +//! For convenience, the contents of this module are available at the root +//! module. Therefore, you can directly type: +//! +//! ``` +//! use iced_web::{button, Button, Widget}; +//! ``` +//! +//! [`Widget`]: trait.Widget.html use crate::Bus; use dodrio::bumpalo; pub mod button; pub mod slider; -pub mod text; mod checkbox; mod column; mod image; mod radio; mod row; +mod text; #[doc(no_inline)] pub use button::Button; @@ -26,7 +42,16 @@ pub use image::Image; pub use radio::Radio; pub use row::Row; +/// A component that displays information and allows interaction. +/// +/// If you want to build your own widgets, you will need to implement this +/// trait. +/// +/// [`Widget`]: trait.Widget.html pub trait Widget<Message> { + /// Produces a VDOM node for the [`Widget`]. + /// + /// [`Widget`]: trait.Widget.html fn node<'b>( &self, bump: &'b bumpalo::Bump, |