pub struct Card<'a> {
pub title: Option<&'a str>,
pub variant: CardVariant,
pub clickable: bool,
pub width: Option<f32>,
pub height: Option<f32>,
pub min_height: Option<f32>,
pub max_height: Option<f32>,
pub inner_margin: Option<f32>,
pub margin: Option<Margin>,
pub fill_color: Option<Color32>,
pub stroke_color: Option<Color32>,
pub corner_radius: Option<f32>,
}Expand description
Card component styled like shadcn/ui
Fields§
§title: Option<&'a str>Optional title for the card
variant: CardVariantCard variant (Filled, Outlined, Elevated)
clickable: boolWhether the card is clickable (adds hover effect)
width: Option<f32>Custom width (None = fill available)
height: Option<f32>Custom height (None = determined by content)
min_height: Option<f32>Custom min height
max_height: Option<f32>Custom max height
inner_margin: Option<f32>Custom inner margin (None = use theme default)
margin: Option<Margin>Custom asymmetric margin (overrides inner_margin if set)
fill_color: Option<Color32>Custom background color (None = use theme default)
stroke_color: Option<Color32>Custom border color (None = use theme default)
corner_radius: Option<f32>Custom corner radius (None = use theme default)
Implementations§
Source§impl<'a> Card<'a>
impl<'a> Card<'a>
Sourcepub const fn height(self, height: f32) -> Self
pub const fn height(self, height: f32) -> Self
Set custom height (forces exact height regardless of content)
Sourcepub const fn min_height(self, height: f32) -> Self
pub const fn min_height(self, height: f32) -> Self
Set minimum height
Sourcepub const fn max_height(self, height: f32) -> Self
pub const fn max_height(self, height: f32) -> Self
Set maximum height
Sourcepub const fn variant(self, variant: CardVariant) -> Self
pub const fn variant(self, variant: CardVariant) -> Self
Set the card variant
Sourcepub const fn clickable(self, clickable: bool) -> Self
pub const fn clickable(self, clickable: bool) -> Self
Make the card clickable (adds hover effect)
Sourcepub const fn inner_margin(self, margin: f32) -> Self
pub const fn inner_margin(self, margin: f32) -> Self
Set custom inner margin (overrides theme default)
Sourcepub const fn margin(self, margin: Margin) -> Self
pub const fn margin(self, margin: Margin) -> Self
Set custom asymmetric margin (overrides inner_margin)
Use this for different padding on each side
Sourcepub const fn fill(self, color: Color32) -> Self
pub const fn fill(self, color: Color32) -> Self
Set custom fill/background color (overrides theme default)
Sourcepub const fn stroke(self, color: Color32) -> Self
pub const fn stroke(self, color: Color32) -> Self
Set custom stroke/border color (overrides theme default)
Sourcepub const fn corner_radius(self, radius: f32) -> Self
pub const fn corner_radius(self, radius: f32) -> Self
Set custom corner radius (overrides theme default)
Sourcepub const fn rounding(self, radius: f32) -> Self
pub const fn rounding(self, radius: f32) -> Self
Alias for corner_radius for backwards compatibility
Sourcepub const fn hover_effect(self, enable: bool) -> Self
pub const fn hover_effect(self, enable: bool) -> Self
Enable hover effect (same as clickable)