pub struct DashboardLayout {
pub config: DashboardLayoutConfig,
}Expand description
Dashboard layout with persistent sidebar, header, and main content area.
Renders a full-page shell with a fixed sidebar on the left (desktop)
and a sticky header at the top. The rendered view content appears in
the <main> area. The built-in JS runtime (FERRO_RUNTIME_JS) is
injected once as a <script> tag, enabling SSE, live-value updates,
and toast notifications.
Mobile: sidebar is hidden by default and toggled via the hamburger button in the header (using responsive Tailwind classes).
This layout is NOT auto-registered. Users must register it at startup:
use ferro_json_ui::{DashboardLayout, DashboardLayoutConfig, HeaderProps, SidebarProps, register_layout};
register_layout("dashboard", DashboardLayout::new(DashboardLayoutConfig {
sidebar: SidebarProps { fixed_top: vec![], groups: vec![], fixed_bottom: vec![] },
header: HeaderProps {
business_name: "My App".to_string(),
notification_count: None,
user_name: None,
user_avatar: None,
logout_url: None,
},
sse_url: None,
}));Fields§
§config: DashboardLayoutConfigLayout configuration (sidebar, header, SSE URL).
Implementations§
Source§impl DashboardLayout
impl DashboardLayout
Sourcepub fn new(config: DashboardLayoutConfig) -> Self
pub fn new(config: DashboardLayoutConfig) -> Self
Create a new DashboardLayout from a DashboardLayoutConfig.
Trait Implementations§
Source§impl Layout for DashboardLayout
impl Layout for DashboardLayout
Source§fn render(&self, ctx: &LayoutContext<'_>) -> String
fn render(&self, ctx: &LayoutContext<'_>) -> String
Render a complete HTML page using the provided context.
Auto Trait Implementations§
impl Freeze for DashboardLayout
impl RefUnwindSafe for DashboardLayout
impl Send for DashboardLayout
impl Sync for DashboardLayout
impl Unpin for DashboardLayout
impl UnsafeUnpin for DashboardLayout
impl UnwindSafe for DashboardLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more