| Crates.io | yew-bootstrap |
| lib.rs | yew-bootstrap |
| version | 0.13.0 |
| created_at | 2021-11-27 21:59:56.646373+00 |
| updated_at | 2025-04-23 00:07:10.673596+00 |
| description | Bootstrap 5 Components for Yew |
| homepage | |
| repository | https://github.com/isosphere/yew-bootstrap/ |
| max_upload_size | |
| id | 488558 |
| size | 806,115 |
This project assumes that you have an existing web application that uses the Yew framework.
Add the dependency next to the regular yew dependency:
[dependencies]
yew = "0.21"
yew-bootstrap = "*"
To use form callback functions, the following dependencies should be added:
[dependencies]
wasm-bindgen = "0.2.*"
web-sys = { version = "0.3.*", features = ["HtmlTextAreaElement", "HtmlSelectElement"] }
Some components need features to be enabled, for example:
[dependencies]
yew = "0.21"
yew-bootstrap = { version = "*", features = ["searchable_select"] }
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:
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.
This project uses semantic versioning.
stretched={true}>)Some additional components are provided, not strictly part of Bootstrap, but based on Boostrap components.
Searchable select ([component::SearchableSelect]) - Requires feature "searchable_select"
A component similar to a Select showing a field to filter the items.
searchable_selectEnables the [component::SearchableSelect], which requires additional dependencies.
Several examples are provided:
examples/basics: Componentsexamples/forms: Form fieldsexamples/searchable_select: Searchable Select componentTo run an example:
cd examples/<directory>
trunk --serve