yew-bootstrap
is a collection of frontend components made to simplify the usage of Bootstrap 5 within the Yew framework.
This project assumes that you have an existing web application that uses the Yew framework. If you do not, refer to Yew Getting Started to get started.
Add the dependency next to the regular yew dependency:
toml
[dependencies]
yew = "0.20"
yew-bootstrap = "0.5.3"
Then in the beginning of your application, include the include_cdn()
or include_inline()
function to load the required CSS. Some components require the Bootstrap JavaScript
library to be loaded - for these you can use the include_cdn_js()
function. It is recommended that you put this at the bottom of your html!{}
macro, as done below:
Rust
fn view(&self, _ctx: &Context<Self>) -> Html {
html! {
<>
{include_cdn()}
<Button style={Color::Primary}>{"Primary"}</Button>
{include_cdn_js()}
</>
}
}
Check main.rs
for example usage for every implemented component.
0.xy
Versions that have the same x
value target the same version of Yew.
There is currently no indication of which version of Bootstrap is targeted, however, we’ll try to target the previous release pipeline. For example as of this writing the latest boostrap is 5.2.x, so we’ll try to target the latest 5.1.x version.
stretched={true}>
)