Struct tui_widgets::popup::Popup
source · #[non_exhaustive]pub struct Popup<'content, W>where
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: WThe body of the popup.
title: Line<'content>The title of the popup.
style: StyleThe style to apply to the entire popup.
borders: BordersThe borders of the popup.
border_set: SetThe symbols used to render the border.
border_style: StyleBorder style
Implementations§
source§impl<'content, W> Popup<'content, W>where
W: SizedWidgetRef,
impl<'content, W> Popup<'content, W>where
W: SizedWidgetRef,
sourcepub fn title(self, value: impl Into<Line<'content>>) -> Popup<'content, W>
pub fn title(self, value: impl Into<Line<'content>>) -> Popup<'content, W>
Sets the title field of this struct.
sourcepub fn style(self, value: impl Into<Style>) -> Popup<'content, W>
pub fn style(self, value: impl Into<Style>) -> Popup<'content, W>
Sets the style field of this struct.
sourcepub fn borders(self, value: impl Into<Borders>) -> Popup<'content, W>
pub fn borders(self, value: impl Into<Borders>) -> Popup<'content, W>
Sets the borders field of this struct.
sourcepub fn border_set(self, value: impl Into<Set>) -> Popup<'content, W>
pub fn border_set(self, value: impl Into<Set>) -> Popup<'content, W>
Sets the border_set field of this struct.
sourcepub fn border_style(self, value: impl Into<Style>) -> Popup<'content, W>
pub fn border_style(self, value: impl Into<Style>) -> Popup<'content, W>
Sets the border_style field of this struct.
Trait Implementations§
source§impl<W> StatefulWidgetRef for Popup<'_, W>where
W: SizedWidgetRef,
impl<W> StatefulWidgetRef for Popup<'_, W>where
W: SizedWidgetRef,
§type State = PopupState
type State = PopupState
State associated with the stateful widget. Read more
source§fn render_ref(
&self,
area: Rect,
buf: &mut Buffer,
state: &mut <Popup<'_, W> as StatefulWidgetRef>::State,
)
fn render_ref( &self, area: Rect, buf: &mut Buffer, state: &mut <Popup<'_, W> as StatefulWidgetRef>::State, )
Draws the current state of the widget in the given buffer. That is the only method required
to implement a custom stateful widget.
source§impl<W> WidgetRef for Popup<'_, W>where
W: SizedWidgetRef,
impl<W> WidgetRef for Popup<'_, W>where
W: SizedWidgetRef,
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