Docs

Documentation versions (currently viewingVaadin 25 (prerelease))

Card Styling

Styling API reference for the Card components.

Style Variants

The Card component supports the following style variants:

Variant Description Supported by

elevated

Adds an elevated appearance with a shadow effect

Aura, Lumo

outlined

Adds a solid border outline to the card

Aura, Lumo

horizontal

Places card content horizontally alongside the media element

Aura, Lumo

stretch-media

Stretches the media element to fill the card width or height

Aura, Lumo

cover-media

Allows the media element to cover the card’s padding area

Aura, Lumo

Source code
CardVariants.java
card-variants.tsx
card-variants.ts

Horizontal

Place all card content on the side of the media element, if provided.

Source code
CardHorizontal.java
card-horizontal.tsx
card-horizontal.ts

Stretch Media

Stretches the media element as wide – or tall, if combined with the horizontal variant – as the card, if the media element is an image, video, or an icon.

Source code
CardStretchMedia.java
card-stretch-media.tsx
card-stretch-media.ts

Cover Media

Similar to the stretch-media variant, but this variant allows the media element to also cover the padding area of the card. This variant overrides the stretch-media variant.

Source code
CardCoverMedia.java
card-cover-media.tsx
card-cover-media.ts

Combine Variants

You can combine all style variants together.

Source code
CardCombineVariants.java
card-combine-variants.tsx
card-combine-variants.ts

Style Properties

The following style properties can be used in CSS stylesheets to customize the appearance of this component.

To apply values to these properties globally in your application UI, place them in a CSS block using the html {…​} selector. See Component Style Properties for more information on style properties.

Common Properties

Property Supported by

--vaadin-card-background

Aura, Lumo

--vaadin-card-shadow

Aura, Lumo

--vaadin-card-border-width

Aura, Lumo

--vaadin-card-border-color

Aura, Lumo

--vaadin-card-border-radius

Aura, Lumo

--vaadin-card-padding

Aura, Lumo

--vaadin-card-gap

Aura, Lumo

--vaadin-card-media-aspect-ratio

Aura, Lumo

--vaadin-card-title-color

Aura, Lumo

--vaadin-card-title-font-size

Aura, Lumo

--vaadin-card-title-font-weight

Aura, Lumo

--vaadin-card-title-line-height

Aura, Lumo

--vaadin-card-subtitle-color

Aura, Lumo

--vaadin-card-subtitle-font-size

Aura, Lumo

--vaadin-card-subtitle-line-height

Aura, Lumo

CSS Selectors

The following CSS selectors can be used in stylesheets to target the various parts and states of the component. See the Styling documentation for more details on how to style components.

Root element

vaadin-card

Parts

Media

vaadin-card::part(media)

Header

vaadin-card::part(header)

Content

vaadin-card::part(content)

Footer

vaadin-card::part(footer)

Title

vaadin-card [slot="title"]

Style Variants

Outlined

vaadin-card[theme~="outlined"]

Elevated

vaadin-card[theme~="elevated"]

Horizontal

vaadin-card[theme~="horizontal"]

Stretch Media

vaadin-card[theme~="stretch-media"]

Cover Media

vaadin-card[theme~="cover-media"]