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

FieldTypeDescription
closedboolClose button was clicked
draggingboolCard is being dragged
drag_deltaVec2Drag movement delta