Skip to main content

EmptyState

Struct EmptyState 

Source
pub struct EmptyState { /* private fields */ }
Expand description

An empty state widget for no-data scenarios

Displays a consistent, helpful message when there’s no content to show.

Implementations§

Source§

impl EmptyState

Source

pub fn new(title: impl Into<String>) -> Self

Create a new empty state with a title

Source

pub fn no_results(title: impl Into<String>) -> Self

Create an empty state for no results

Source

pub fn error(title: impl Into<String>) -> Self

Create an error empty state

Source

pub fn no_permission(title: impl Into<String>) -> Self

Create a no permission empty state

Source

pub fn offline(title: impl Into<String>) -> Self

Create an offline empty state

Source

pub fn first_use(title: impl Into<String>) -> Self

Create a first-use empty state

Source

pub fn description(self, description: impl Into<String>) -> Self

Set the description text

Source

pub fn state_type(self, state_type: EmptyStateType) -> Self

Set the state type

Source

pub fn variant(self, variant: EmptyStateVariant) -> Self

Set the visual variant

Source

pub fn icon(self, show: bool) -> Self

Show/hide the icon

Source

pub fn custom_icon(self, icon: char) -> Self

Set a custom icon

Source

pub fn action(self, action: impl Into<String>) -> Self

Set an action button text

Source

pub fn height(&self) -> u16

Calculate the height needed for this empty state

Source§

impl EmptyState

Source

pub fn focused(self, focused: bool) -> Self

Set focused state

Source

pub fn disabled(self, disabled: bool) -> Self

Set disabled state

Source

pub fn fg(self, color: Color) -> Self

Set foreground color

Source

pub fn bg(self, color: Color) -> Self

Set background color

Source

pub fn is_focused(&self) -> bool

Check if widget is focused

Source

pub fn is_disabled(&self) -> bool

Check if widget is disabled

Source

pub fn set_focused(&mut self, focused: bool)

Set focused state (mutable)

Source§

impl EmptyState

Source

pub fn element_id(self, id: impl Into<String>) -> Self

Set element ID for CSS selector (#id)

Source

pub fn class(self, class: impl Into<String>) -> Self

Add a CSS class

Source

pub fn classes<I, S>(self, classes: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Add multiple CSS classes

Trait Implementations§

Source§

impl Default for EmptyState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl StyledView for EmptyState

Source§

fn set_id(&mut self, id: impl Into<String>)

Set element ID
Source§

fn add_class(&mut self, class: impl Into<String>)

Add a CSS class
Source§

fn remove_class(&mut self, class: &str)

Remove a CSS class
Source§

fn toggle_class(&mut self, class: &str)

Toggle a CSS class
Source§

fn has_class(&self, class: &str) -> bool

Check if has class
Source§

impl View for EmptyState

Source§

fn id(&self) -> Option<&str>

Get element ID (for CSS #id selectors) Read more
Source§

fn classes(&self) -> &[String]

Get CSS classes (for CSS .class selectors) Read more
Source§

fn meta(&self) -> WidgetMeta

Get widget metadata for DOM Read more
Source§

fn render(&self, ctx: &mut RenderContext<'_>)

Render the view to the given context Read more
Source§

fn widget_type(&self) -> &'static str

Get widget type name (for CSS type selectors) Read more
Source§

fn children(&self) -> &[Box<dyn View>]

Get child views (for container widgets) Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.