Skip to content

Card

Used to display product images, prices and other information.

Component Type

Basic Usage

Set title through title, pass content through default slot, use footer slot for bottom operation area.

html
<wd-card title="Yueyang Tower Record">
  <view class="content-text">
    When spring scenery is bright and calm, waves are still, the sky and water merge into one vast expanse of blue, seagulls hover and gather, glittering fish swim, shore plants flourish in green.
  </view>
  <template #footer>
    <wd-button size="small" plain>Read Full Text</wd-button>
  </template>
</wd-card>

Rectangle Card

Set type="rectangle" to use rectangle card style.

html
<wd-card title="Life Record" type="rectangle">
  <view class="list-group">
    <view class="list-item">
      <image src="https://wot-ui.cn/assets/panda.jpg" class="list-item__image" mode="aspectFill" />
      <view class="list-item__content">
        <view class="list-item__title">Great Weather Today</view>
        <view class="list-item__desc">Feb 11, 2026 Sunny 22°C</view>
      </view>
    </view>
  </view>
  <template #footer>
    <wd-button size="small" plain>Like</wd-button>
  </template>
</wd-card>

Component Style

Complex Card

Build higher information density card content by combining images, tags, and attribute blocks.

html
<wd-card title="Pet Profile">
  <view class="info-card">...</view>
  <template #footer>
    <wd-button size="small" plain>Like (1.2w)</wd-button>
  </template>
</wd-card>

Content Form

Custom Title

Use title slot to customize title area content.

html
<wd-card type="rectangle">
  <template #title>
    <view class="custom-title">
      <view>Hobbies</view>
      <view class="custom-title__tip">
        <wd-icon name="heart" size="14px" custom-style="vertical-align: bottom; margin-right: 4px;" />
        Source of Happiness
      </view>
    </view>
  </template>
  <view class="list-group">...</view>
</wd-card>

Special Style

Bottom area will not render when footer slot is not passed.

html
<wd-card title="Wonderful Moments" type="rectangle">
  <view class="moment-card">...</view>
</wd-card>

Attributes

ParameterDescriptionTypeDefault Value
titleCard titlestring-
typeCard type, supports rectanglestring-
custom-title-classTitle area custom class namestring''
custom-content-classContent area custom class namestring''
custom-footer-classBottom area custom class namestring''
custom-classRoot node custom class namestring''
custom-styleRoot node custom stylestring''

Slots

nameDescription
defaultCard content
titleCard title
footerBottom operation content

主题定制

CSS 变量

组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 全局配置

名称默认值描述
--wot-card-bg$filled-oppo卡片背景色
--wot-card-border-color$border-light卡片边框颜色
--wot-card-radius$radius-large卡片圆角
--wot-card-shadow$n-0 $n-2 $n-8 $opac-2_04卡片阴影
--wot-card-shadow-hover$n-0 $n-4 $n-16 $opac-3_08卡片悬浮阴影
--wot-card-transitionbox-shadow 0.3s ease过渡动画
--wot-card-margin-bottom$spacing-extra-loose卡片底部间距
--wot-card-margin-horizontal$spacing-extra-loose卡片水平方向外边距
--wot-card-title-color$text-main标题颜色
--wot-card-title-font-size$typography-title-size-main标题字号
--wot-card-title-font-weight$font-weight-medium标题字重
--wot-card-title-line-height$typography-body-line--height-size-main标题行高
--wot-card-title-padding$padding-loose $padding-extra-loose标题内间距
--wot-card-content-color$text-secondary内容文字颜色
--wot-card-content-font-size$typography-body-size-main内容字号
--wot-card-content-line-height$typography-body-line--height-size-main内容行高
--wot-card-content-padding$padding-main $padding-loose内容内边距
--wot-card-content-border-color$border-main内容区域边框颜色
--wot-card-footer-padding$padding-tight $padding-loose底部内边距
--wot-card-footer-border-color$border-main底部分割线颜色

Source Code

Documentation
Component

Released under the MIT License.

Released under the MIT License.