2024-01-03 20:52:56 +08:00
|
|
|
# Nav Bar
|
|
|
|
|
|
|
|
```rust
|
|
|
|
use thaw::mobile::*;
|
|
|
|
|
|
|
|
let click_text = create_rw_signal(String::from("none"));
|
|
|
|
let on_click_left = move |_| click_text.set("left".to_string());
|
|
|
|
let on_click_right = move |_| click_text.set("right".to_string());
|
|
|
|
|
|
|
|
view! {
|
|
|
|
<div style="height: 100vh;">
|
|
|
|
<NavBar
|
|
|
|
title="Home"
|
|
|
|
left_arrow=true
|
|
|
|
left_text="back"
|
|
|
|
on_click_left=on_click_left
|
|
|
|
on_click_right=on_click_right
|
2024-01-16 14:22:33 +00:00
|
|
|
>
|
|
|
|
<NavBarRight slot>
|
2024-01-26 23:10:17 +09:00
|
|
|
<Icon icon=icondata::AiCloseOutlined/>
|
2024-01-16 14:22:33 +00:00
|
|
|
</NavBarRight>
|
|
|
|
</NavBar>
|
2024-01-03 20:52:56 +08:00
|
|
|
<div style="padding-top: 50px">{move || click_text.get()}</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### NavBar Props
|
|
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
| class | `MaybeSignal<String>` | `Default::default()` | Addtional classes for the NavBar element. |
|
|
|
|
| title | `MaybeSignal<String>` | `Default::default()` | NavBar title. |
|
|
|
|
| left_arrow | `MaybeSignal<bool>` | `false` | Whether to show left arrow. |
|
|
|
|
| left_text | `MaybeSignal<String>` | `Default::default()` | NavBar left text. |
|
|
|
|
| on_click_left | `Option<Callback<ev::MouseEvent>>` | `Default::default()` | NavBar left click. |
|
|
|
|
| right_text | `MaybeSignal<String>` | `Default::default()` | NavBar right text. |
|
|
|
|
| on_click_right | `Option<Callback<ev::MouseEvent>>` | `Default::default()` | NavBar right click. |
|
2024-01-16 14:22:33 +00:00
|
|
|
|
|
|
|
### NavBarLeft and NavBarRight Props
|
|
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
| class | `MaybeSignal<String>` | `Default::default()` | Addtional classes for the element. |
|