use fission::prelude::*;
fission_component! {
pub FilterDrawer<()> {
props { filters: Widget }
state { open: bool = false }
}
view(drawer, _state, cx) =>
Column(
children: [
Button(
child: Text(cx.tr("search.filters")),
on_press: reduce { drawer.open = true; },
),
Drawer(
id: WidgetId::explicit("search.filters"),
side: DrawerSide::Right,
is_open: drawer.open,
dismiss_semantics_identifier: Some("search.close-filters".into()),
content: drawer.filters.clone(),
on_dismiss: reduce { drawer.open = false; },
),
],
)
}
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
id | WidgetId | Stable identity for the portal entry. | Required. Give each drawer a stable id so the runtime can track it consistently. |
side | DrawerSide | Which horizontal edge the panel attaches to. | Use Left or Right. |
is_open | bool | Whether the drawer should be visible this frame. | Controlled visibility, including any retained exit transition. |
on_dismiss | Option<ActionEnvelope> | Action dispatched when the backdrop is tapped. | Defaults to None. If you omit it, the backdrop still covers the screen but does not close the drawer for you. |
motion | Option<DrawerMotion> | Entry/exit transition policy. | None follows standard widget motion. |
dismiss_semantics_identifier | Option<String> | Stable backdrop-dismissal test identifier. | Useful when a page has several overlays. |
content | Widget | The panel body. | Build the full drawer user interface here. |
width | Option<f32> | Requested panel width in logical pixels. | Defaults to 300.0. The runtime clamps it to the current viewport so the drawer still fits on smaller screens. |