pub struct Sidebar<C, P = ()> { /* private fields */ }Expand description
A navigation column: Sidebar::new((SidebarSection::new("Workspace"), SidebarItem::new(...), ...)).
Its children scroll between an optional header and footer. With
Self::collapsible it closes to icons or off the screen, by Cmd/Ctrl+B or
a SidebarTrigger. With Self::narrow_below small windows show it as a
sheet over the page.
use ravenrs_widgets::*;
let state = SidebarState::new(true);
let sidebar = Sidebar::new((
SidebarGroup::new("Workspace", (
SidebarItem::new(IconName::House, "Home").selected(true),
SidebarItem::new(IconName::Users, "People").badge(Badge::new("3")),
)),
))
.collapsible(SidebarCollapse::Icons)
.narrow_below(768.0)
.state(state.clone());
let trigger = SidebarTrigger::new(state);Implementations§
Source§impl<C, P> Sidebar<C, P>where
C: ViewSeq,
impl<C, P> Sidebar<C, P>where
C: ViewSeq,
Sourcepub fn collapsible(self, collapse: SidebarCollapse) -> Sidebar<C, P>
pub fn collapsible(self, collapse: SidebarCollapse) -> Sidebar<C, P>
What it does when it closes (SidebarCollapse::Fixed by default).
Rows, groups and scroll position that are not bound to app state start
over after SidebarCollapse::Hidden, since nothing is built meanwhile.
Sourcepub fn variant(self, variant: SidebarVariant) -> Sidebar<C, P>
pub fn variant(self, variant: SidebarVariant) -> Sidebar<C, P>
How it sits next to the page (SidebarVariant::Standard by default).
Sourcepub fn side(self, side: Side) -> Sidebar<C, P>
pub fn side(self, side: Side) -> Sidebar<C, P>
The window edge it belongs to (Side::Left by default). Place it on
that side of the page yourself; this sets its hairline, the side of its
tooltips and where its sheet comes from.
Sourcepub fn narrow_below(self, width: f32) -> Sidebar<C, P>
pub fn narrow_below(self, width: f32) -> Sidebar<C, P>
Below this window width, in logical pixels, it takes no room and opens as a sheet over the page. It goes by the window, not by its container.
Sourcepub fn shortcut(self, enabled: bool) -> Sidebar<C, P>
pub fn shortcut(self, enabled: bool) -> Sidebar<C, P>
Whether Cmd/Ctrl+B toggles it, if it can close (on by default). Turn it off when a window has more than one sidebar, or the app uses that key.
Source§impl<C, P> Sidebar<C, P>
impl<C, P> Sidebar<C, P>
Sourcepub fn state(self, state: SidebarState) -> Sidebar<C, SidebarParts>
pub fn state(self, state: SidebarState) -> Sidebar<C, SidebarParts>
Shares whether it is open with a SidebarTrigger or the app. Without
this it starts open and keeps the state itself.
Sourcepub fn header(self, header: impl View + 'static) -> Sidebar<C, SidebarParts>
pub fn header(self, header: impl View + 'static) -> Sidebar<C, SidebarParts>
A view above the content that does not scroll. Reduced to icons, it keeps its layout and shows what fits, so start it with an icon.
A view below the content that does not scroll, treated like the header.
Trait Implementations§
Auto Trait Implementations§
impl<C, P> Freeze for Sidebar<C, P>
impl<C, P> RefUnwindSafe for Sidebar<C, P>where
C: RefUnwindSafe,
P: RefUnwindSafe,
impl<C, P> Send for Sidebar<C, P>
impl<C, P> Sync for Sidebar<C, P>
impl<C, P> Unpin for Sidebar<C, P>
impl<C, P> UnsafeUnpin for Sidebar<C, P>where
C: UnsafeUnpin,
P: UnsafeUnpin,
impl<C, P> UnwindSafe for Sidebar<C, P>where
C: UnwindSafe,
P: UnwindSafe,
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.