Skip to main content

DashboardLayout

Struct DashboardLayout 

Source
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: DashboardLayoutConfig

Layout configuration (sidebar, header, SSE URL).

Implementations§

Source§

impl DashboardLayout

Source

pub fn new(config: DashboardLayoutConfig) -> Self

Create a new DashboardLayout from a DashboardLayoutConfig.

Trait Implementations§

Source§

impl Layout for DashboardLayout

Source§

fn render(&self, ctx: &LayoutContext<'_>) -> String

Render a complete HTML page using the provided context.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.