pub enum LayoutTemplate {
Standard(StandardOptions),
Sidebar(SidebarOptions),
Split(SplitOptions),
Minimal(MinimalOptions),
Custom(Box<dyn LayoutProvider>),
CustomFn(Box<dyn Fn(Rect, &LayoutContext<'_>, &WidgetSizes) -> LayoutResult + Sync + Send>),
}Expand description
Layout templates with customization options
Templates provide common layout patterns. Use Custom or CustomFn
for full control with ratatui.
Variants§
Standard(StandardOptions)
Standard vertical layout: chat (fills), panels, input, status bar
Sidebar(SidebarOptions)
Sidebar layout: main content + sidebar
Split(SplitOptions)
Split layout: two main areas side by side or stacked
Minimal(MinimalOptions)
Minimal layout: just chat and input, no status bar
Custom(Box<dyn LayoutProvider>)
Custom layout using a LayoutProvider implementation
CustomFn(Box<dyn Fn(Rect, &LayoutContext<'_>, &WidgetSizes) -> LayoutResult + Sync + Send>)
Custom layout using a closure
Implementations§
Source§impl LayoutTemplate
impl LayoutTemplate
Sourcepub fn standard() -> LayoutTemplate
pub fn standard() -> LayoutTemplate
Create a standard layout with default options
Sourcepub fn with_panels() -> LayoutTemplate
pub fn with_panels() -> LayoutTemplate
Create a standard layout with panels (permission, question, slash popup)
Create a sidebar layout
Sourcepub fn minimal() -> LayoutTemplate
pub fn minimal() -> LayoutTemplate
Create a minimal layout (no status bar, no panels)
Sourcepub fn split_horizontal(
left_widget_id: &'static str,
right_widget_id: &'static str,
) -> LayoutTemplate
pub fn split_horizontal( left_widget_id: &'static str, right_widget_id: &'static str, ) -> LayoutTemplate
Create a horizontal split layout
Sourcepub fn split_vertical(
top_widget_id: &'static str,
bottom_widget_id: &'static str,
) -> LayoutTemplate
pub fn split_vertical( top_widget_id: &'static str, bottom_widget_id: &'static str, ) -> LayoutTemplate
Create a vertical split layout
Sourcepub fn custom<P>(provider: P) -> LayoutTemplatewhere
P: LayoutProvider,
pub fn custom<P>(provider: P) -> LayoutTemplatewhere
P: LayoutProvider,
Create a custom layout using a LayoutProvider
Sourcepub fn custom_fn<F>(f: F) -> LayoutTemplate
pub fn custom_fn<F>(f: F) -> LayoutTemplate
Create a custom layout using a closure
Sourcepub fn compute(
&self,
ctx: &LayoutContext<'_>,
sizes: &WidgetSizes,
) -> LayoutResult
pub fn compute( &self, ctx: &LayoutContext<'_>, sizes: &WidgetSizes, ) -> LayoutResult
Compute the layout for the given context
Trait Implementations§
Source§impl Default for LayoutTemplate
impl Default for LayoutTemplate
Source§fn default() -> LayoutTemplate
fn default() -> LayoutTemplate
Auto Trait Implementations§
impl Freeze for LayoutTemplate
impl !RefUnwindSafe for LayoutTemplate
impl Send for LayoutTemplate
impl Sync for LayoutTemplate
impl Unpin for LayoutTemplate
impl !UnwindSafe for LayoutTemplate
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more