pub struct ShellContext {
pub layout: Signal<ShellLayout>,
pub breakpoint: ReadSignal<ShellBreakpoint>,
pub sidebar_visible: Signal<bool>,
pub sidebar_mobile_open: Signal<bool>,
pub mobile_sidebar: ReadSignal<MobileSidebar>,
pub desktop_sidebar: ReadSignal<DesktopSidebar>,
pub stack_depth: Signal<u32>,
pub modal_open: Signal<bool>,
pub search_active: Signal<bool>,
pub sheet_snap: Signal<SheetSnap>,
/* private fields */
}Expand description
Reactive context shared across the shell tree.
Provided by AppShell via use_context_provider. Access it from any
descendant component with use_shell_context.
Fields§
§layout: Signal<ShellLayout>Current layout mode, reactive via Signal.
breakpoint: ReadSignal<ShellBreakpoint>Current viewport breakpoint, read-only reactive signal.
Whether the desktop sidebar is in its expanded state (true) or not (false).
For Full: true = visible at full width, false = collapsed to zero.
For Expandable: true = full width, false = rail width.
For Rail: ignored (rail is always visible at its fixed width).
Whether the mobile overlay sidebar is open.
Mobile sidebar variant (Drawer, Rail, or Hidden).
Desktop sidebar variant (Full, Rail, or Expandable).
stack_depth: Signal<u32>Stack navigation depth. Starts at 1 (root screen).
modal_open: Signal<bool>Whether the full-screen modal is currently presented.
search_active: Signal<bool>Whether the search overlay is currently active.
sheet_snap: Signal<SheetSnap>Current snap position of the persistent bottom sheet.
Implementations§
Source§impl ShellContext
impl ShellContext
Sourcepub fn is_mobile(&self) -> bool
pub fn is_mobile(&self) -> bool
true when the current breakpoint is compact (phone-sized viewport).
Toggles the appropriate sidebar state based on the current breakpoint.
- On mobile: toggles
sidebar_mobile_open(overlay open/closed) - On desktop
Full/Expandable: togglessidebar_visible - On desktop
Rail: no-op (rail is always visible)
Takes &self because Signal has interior mutability.
Returns the data-shell-sidebar-state attribute value for the root element.
| Context | Value |
|---|---|
| Mobile open | "open" |
| Mobile closed | "closed" |
| Desktop expanded | "expanded" |
Desktop Full collapsed | "collapsed" |
Desktop Rail (always) | "rail" |
Desktop Expandable collapsed | "rail" |
Sourcepub fn push_stack(&self)
pub fn push_stack(&self)
Pushes a new screen onto the stack (increments depth by 1).
Sourcepub fn reset_stack(&self)
pub fn reset_stack(&self)
Resets the stack to the root screen (depth 1).
Sourcepub fn can_go_back(&self) -> bool
pub fn can_go_back(&self) -> bool
true when there is at least one screen above the root to pop back to.
Sourcepub fn open_modal(&self)
pub fn open_modal(&self)
Presents the full-screen modal.
Sourcepub fn close_modal(&self)
pub fn close_modal(&self)
Dismisses the full-screen modal.
Sourcepub fn toggle_modal(&self)
pub fn toggle_modal(&self)
Toggles the full-screen modal between presented and dismissed.
Sourcepub fn open_search(&self)
pub fn open_search(&self)
Activates the search overlay.
Sourcepub fn close_search(&self)
pub fn close_search(&self)
Deactivates the search overlay.
Sourcepub fn toggle_search(&self)
pub fn toggle_search(&self)
Toggles the search overlay between active and inactive.
Sourcepub fn set_sheet_snap(&self, snap: SheetSnap)
pub fn set_sheet_snap(&self, snap: SheetSnap)
Sets the bottom sheet to the given snap position.
Trait Implementations§
Source§impl Clone for ShellContext
impl Clone for ShellContext
Source§fn clone(&self) -> ShellContext
fn clone(&self) -> ShellContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more