pub struct Card<V> { /* private fields */ }Expand description
A grouped surface lifted off the canvas: bg-200 fill, radius-xl corners,
shadow-soft and a hairline border, padded by space-6.
Implementations§
Source§impl<V: View> Card<V>
impl<V: View> Card<V>
Sourcepub fn new(content: V) -> Self
pub fn new(content: V) -> Self
A card around content with the theme’s surface, radius, shadow and padding.
Sourcepub fn corner_radius(self, radius: f32) -> Self
pub fn corner_radius(self, radius: f32) -> Self
Corner radius in logical pixels (theme radius-xl by default).
Sourcepub fn fill(self, fill: impl Into<Fill>) -> Self
pub fn fill(self, fill: impl Into<Fill>) -> Self
Background, as a theme role (SurfaceElevated by default) or a literal color.
Sourcepub fn border(self, visible: bool) -> Self
pub fn border(self, visible: bool) -> Self
Shows or hides the hairline border (shown by default).
Sourcepub fn on_click(self, handler: impl Fn() + 'static) -> Self
pub fn on_click(self, handler: impl Fn() + 'static) -> Self
Makes the whole card a button: it runs handler when clicked, or on
Enter and Space while focused, and marks hover with the accent.
Sourcepub fn selected(self, selected: bool) -> Self
pub fn selected(self, selected: bool) -> Self
Marks it as the chosen one among others: a thicker accent border and a tint of
the accent, with screen readers told which. Works with or without
Self::on_click, and shows even with Self::border off.
Trait Implementations§
Auto Trait Implementations§
impl<V> !RefUnwindSafe for Card<V>
impl<V> !Send for Card<V>
impl<V> !Sync for Card<V>
impl<V> !UnwindSafe for Card<V>
impl<V> Freeze for Card<V>where
V: Freeze,
impl<V> Unpin for Card<V>where
V: Unpin,
impl<V> UnsafeUnpin for Card<V>where
V: UnsafeUnpin,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.