Skip to content
Latestv1.0.60

Card

A versatile card container for text, lists, images, paragraphs, and other content.

Basic Usage

Set the card title with the header prop.

Basic Usage

Simple Card

The title can be omitted, keeping only the content area.

Simple Card

Extra Actions

Use the #extra slot to add action buttons on the right side of the header.

Extra Actions

Shadow

Control when the card shadow appears with the shadow prop.

Shadow

Hover Effect

Set the hoverable prop to create a lift effect on hover.

Hover Effect

Loading State

Set the loading prop to show a skeleton loading state.

Loading

Use the #footer slot to add footer content.

Footer

Sizes

Set the card size with the size prop.

Sizes

Borderless

Set bordered to false to remove the border.

Borderless

Use in Nuxt

The Card component fully supports Nuxt 3/4 environments. Since it is primarily used for structured layouts, server-side rendering (SSR) can pre-generate the complete DOM structure, benefiting SEO optimization and first-screen rendering performance.

Use in Nuxt

SSR Notes:

  • ✅ Header, footer, and content areas fully rendered on the server
  • ✅ Shadow effects (always/hover/never) support SSR
  • ✅ Skeleton loading state (loading) displays on first screen during SSR, avoiding blank screens
  • ✅ Size and bordered configurations take effect via CSS class names on the server
  • 💡 Interactive logic and dynamic loading state toggling recover reactivity after client-side activation (Hydration)

SEO Optimization

The HTML generated by the Card component is semantically clear. It is recommended to use appropriate heading tags (such as h3) in the header slot to further improve search engine understanding of page content.

API

Props

PropDescriptionTypeDefault
headerCard titlestring
body-styleStyle for the card content areaobject
header-styleStyle for the card headerobject
shadowWhen to show card shadow'always' | 'hover' | 'never''always'
borderedWhether to show borderbooleantrue
hoverableWhether hoverable (lift effect on hover)booleanfalse
sizeCard size'small' | 'default' | 'large''default'
loadingWhether loading (shows skeleton)booleanfalse
body-paddingWhether to have paddingbooleantrue
theme-overridesComponent-level theme overridesComponentThemeVarsundefined

Slots

Slot NameDescription
defaultCard content
headerCard title
extraCard extra action area
footerCard footer content

Theme Variables

VariableDescriptionDefault
--yh-card-bg-colorBackground colorvar(--yh-bg-color-overlay)
--yh-card-border-colorBorder colorvar(--yh-border-color-light)
--yh-card-border-radiusBorder radiusvar(--yh-border-radius-base)
--yh-card-header-paddingHeader padding18px 20px
--yh-card-body-paddingBody padding20px
--yh-card-footer-paddingFooter padding18px 20px
--yh-card-shadowCard shadowvar(--yh-box-shadow-light)

Events

This component does not expose component events.

Expose

This component does not expose public instance methods or properties.

Type Exports

NameDescription
YhCardPropsProps type for YhCard
YhCardSlotsSlots type for YhCard
YhCardShadowCard shadow mode type
YhCardInstancePublic instance type for YhCard

Released under the MIT License.