Module yew::prelude

source ·
Expand description

The Yew Prelude

The purpose of this module is to alleviate imports of many common types:

use yew::prelude::*;


pub use crate::callback::Callback;
pub use crate::context::ContextHandle;
pub use crate::context::ContextProvider;
pub use crate::html::create_portal;
pub use crate::html::Html;
pub use crate::html::HtmlResult;
pub use crate::html::NodeRef;
pub use crate::macros::html;
pub use crate::virtual_dom::AttrValue;
pub use crate::events::*;
pub use crate::functional::*;



An instance of an application.
A set of classes.
The Component’s context. This contains component’s Scope and props and is passed to every lifecycle method.
Suspensecsr or ssr
Suspend rendering and show a fallback UI until the underlying task completes.


The common base of both function components and struct components.
Components are the basic building blocks of the UI in a Yew app. Each Component chooses how to display itself using received props and self-managed state. Components can be dynamic and interactive by declaring messages that are triggered and handled asynchronously. This async update mechanism is inspired by Elm and the actor model used in the Actix framework.
Trait for building properties for a component

Type Definitions

A type used for accepting children elements in Component::Properties.
A type used for accepting children elements in Component::Properties and accessing their props.

Derive Macros