#[non_exhaustive]pub struct Popup<'content, W: SizedWidgetRef> {
pub body: W,
pub title: Line<'content>,
pub style: Style,
pub borders: Borders,
pub border_set: Set,
pub border_style: Style,
}
Expand description
Configuration for a popup.
This struct is used to configure a Popup
. It can be created using
Popup::new
.
§Example
use ratatui::{prelude::*, symbols::border};
use tui_popup::Popup;
fn render_popup(frame: &mut Frame) {
let popup = Popup::new("Press any key to exit")
.title("tui-popup demo")
.style(Style::new().white().on_blue())
.border_set(border::ROUNDED)
.border_style(Style::new().bold());
frame.render_widget(&popup, frame.size());
}
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.body: W
The body of the popup.
title: Line<'content>
The title of the popup.
style: Style
The style to apply to the entire popup.
borders: Borders
The borders of the popup.
border_set: Set
The symbols used to render the border.
border_style: Style
Border style
Implementations§
Source§impl<'content, W: SizedWidgetRef> Popup<'content, W>
impl<'content, W: SizedWidgetRef> Popup<'content, W>
Sourcepub fn title(self, value: impl Into<Line<'content>>) -> Self
pub fn title(self, value: impl Into<Line<'content>>) -> Self
Sets the title
field of this struct.
Sourcepub fn border_set(self, value: impl Into<Set>) -> Self
pub fn border_set(self, value: impl Into<Set>) -> Self
Sets the border_set
field of this struct.
Sourcepub fn border_style(self, value: impl Into<Style>) -> Self
pub fn border_style(self, value: impl Into<Style>) -> Self
Sets the border_style
field of this struct.
Trait Implementations§
Source§impl<W: SizedWidgetRef> StatefulWidgetRef for Popup<'_, W>
impl<W: SizedWidgetRef> StatefulWidgetRef for Popup<'_, W>
Source§impl<W: SizedWidgetRef> WidgetRef for Popup<'_, W>
impl<W: SizedWidgetRef> WidgetRef for Popup<'_, W>
Source§fn render_ref(&self, area: Rect, buf: &mut Buffer)
fn render_ref(&self, area: Rect, buf: &mut Buffer)
Draws the current state of the widget in the given buffer. That is the only method required
to implement a custom widget.
Auto Trait Implementations§
impl<'content, W> Freeze for Popup<'content, W>where
W: Freeze,
impl<'content, W> RefUnwindSafe for Popup<'content, W>where
W: RefUnwindSafe,
impl<'content, W> Send for Popup<'content, W>where
W: Send,
impl<'content, W> Sync for Popup<'content, W>where
W: Sync,
impl<'content, W> Unpin for Popup<'content, W>where
W: Unpin,
impl<'content, W> UnwindSafe for Popup<'content, W>where
W: UnwindSafe,
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
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>
Converts
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>
Converts
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