Skip to main content

Card

Struct Card 

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

A styled card surface.

Card::new().heading("Setup").show(ui, |ui| {
    ui.label("Card contents go here.");
});

Implementations§

Source§

impl Card

Source

pub fn new() -> Self

Create a card with the default padding, fill, and border.

Source

pub fn heading(self, heading: impl Into<WidgetText>) -> Self

Show a small caption at the top of the card.

Source

pub fn padding(self, padding: f32) -> Self

Override the default inner padding (points).

Source

pub fn fill(self, fill: Color32) -> Self

Override the fill colour.

Source

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

Toggle the 1-px border. Defaults to on.

Source

pub fn corner_radius(self, radius: impl Into<CornerRadius>) -> Self

Override the corner radius (per-corner). Useful for segmented layouts where only some corners should be rounded.

Source

pub fn show<R>( self, ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R, ) -> InnerResponse<R>

Render the card and its body contents, returning whatever the closure returns inside an InnerResponse.

Trait Implementations§

Source§

impl Debug for Card

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Card

Source§

fn default() -> Card

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

Auto Trait Implementations§

§

impl Freeze for Card

§

impl RefUnwindSafe for Card

§

impl Send for Card

§

impl Sync for Card

§

impl Unpin for Card

§

impl UnsafeUnpin for Card

§

impl UnwindSafe for Card

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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.