Sidebar Card
A card that can be docked to the toolbar or detached as a floating panel. Paints its own backdrop, border glow, and handle animation.
Usage
rust
use ui_theme::components::sidebar_card::{sidebar_card, SidebarCardResponse};
let response = sidebar_card(
ui, &theme,
egui::Id::new("my_sidebar"),
rect,
open_t,
"Layers",
false, // highlight
|ui| {
ui.label("Sidebar content");
},
); Props
| Prop | Type | Default | Description |
|---|---|---|---|
ui | &mut Ui | required | The egui UI context |
theme | &Theme | required | Theme instance |
id | Id | required | Unique widget ID |
rect | Rect | required | Card rectangle |
open_t | f32 | required | Open animation progress (0..1) |
title | &str | required | Card title |
highlight | bool | required | Show attention glow |
add_contents | impl FnOnce(&mut Ui) | required | Card body content |
Response
| Field | Type | Description |
|---|---|---|
closed | bool | Close button was clicked |
dragging | bool | Card is being dragged |
drag_delta | Vec2 | Drag movement delta |