2023-12-31 23:33:05 +08:00
|
|
|
# Modal
|
|
|
|
|
|
|
|
```rust demo
|
|
|
|
let show = create_rw_signal(false);
|
|
|
|
|
|
|
|
view! {
|
|
|
|
<Button on_click=move |_| show.set(true)>"Open Modal"</Button>
|
|
|
|
<Modal title="title" show>
|
|
|
|
"hello"
|
|
|
|
</Modal>
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Modal Props
|
|
|
|
|
2024-02-26 21:56:29 +08:00
|
|
|
| Name | Type | Default | Description |
|
|
|
|
| -------------- | --------------------- | -------------------- | ------------------------------------------- |
|
|
|
|
| show | `Model<bool>` | | Whether to show modal. |
|
|
|
|
| title | `MaybeSignal<String>` | `Default::default()` | Modal title. |
|
|
|
|
| width | `MaybeSignal<String>` | `600px` | Modal width. |
|
|
|
|
| z_index | `MaybeSignal<i16>` | `2000` | z-index of the modal. |
|
|
|
|
| mask_closeable | `MaybeSignal<bool>` | `true` | Whether to emit hide event when click mask. |
|
2024-04-05 18:46:12 +08:00
|
|
|
| close_on_esc | `bool` | `true` | Whether to close modal on Esc is pressed. |
|
2024-02-26 21:56:29 +08:00
|
|
|
| children | `Children` | | Modal's content. |
|
2023-12-31 23:33:05 +08:00
|
|
|
|
|
|
|
### Modal Slots
|
|
|
|
|
|
|
|
| Name | Default | Description |
|
|
|
|
| ----------- | ------- | --------------- |
|
|
|
|
| ModalFooter | `None` | Footer content. |
|