Universal Component

Card

Component documentation for Card.

This page was migrated by AI, please review carefully

Migration is complete, but please validate against source code and manual review.

Card

Component documentation for Card.

Basic Usage

Basic

Demo loads on client.

Basic slots

Demo loads on client.

Inertial Follow-Back (inertial)

inertial

Demo loads on client.

Card with Title

Demo loads on client.

Card with Action Buttons

Demo loads on client.

Card Variants

Provides multiple visual styles:

variants

Demo loads on client.

Effects on Different Backgrounds (refraction / glass / blur)

Single-card comparison: text/graphics behind the card, toggle background (refraction / glass / blur / mask) via the switch. refraction is the recommended advanced style.

Card backgrounds (scroll)

Demo loads on client.

Empty Layout

Card with Empty

Demo loads on client.

Using with Components (Popover / SearchSelect)

Card compositions

Demo loads on client.

Card Sizes

size

Demo loads on client.

Layout Props (padding / radius)

layout props

Demo loads on client.

States (clickable / loading / disabled)

states

Demo loads on client.

Selection Guide (TxBaseSurface vs TxCard)

  • Prefer TxCard for higher-level, production-oriented usage. It already bundles variant/shadow/slots/loading/inertial and pointer-light + spring interactions.
  • Use TxBaseSurface when you need low-level material tuning, especially refraction/filter parameters (displace, distortionScale, redOffset/greenOffset/blueOffset, filterSaturation/filterContrast/filterBrightness, refractionHaloOpacity).
  • Convention: keep TxCard as a stable, out-of-the-box API; do material experiments and brand-level rendering in TxBaseSurface.

API Reference

Props

PropTypeDefaultDescription
variant'solid' | 'dashed' | 'plain''solid'Description for variant.
background'blur' | 'glass' | 'refraction' | 'mask''refraction'Background style mapping: blur=filter layer, glass=glass layer, refraction=glass+filter (default recommended), mask=mask layer
shadow'none' | 'soft' | 'medium''none'Description for shadow.
size'small' | 'medium' | 'large''medium'TextSize
radiusnumber18Description for radius.
paddingnumber-Description for padding.
glassBlurbooleantrueApplies when background='glass' | 'refraction': enables blur.
glassBlurAmountnumber22Applies when background='glass' | 'refraction': blur strength (px).
glassOverlaybooleantrueApplies when background='glass' | 'refraction': enables highlight overlay.
glassOverlayOpacitynumber0.18Applies when background='glass' | 'refraction': overlay opacity.
fallbackMaskOpacitynumber0.26Mask opacity (0-1) while motion fallback is active.
refractionStrengthnumber62Applies when background='refraction': refraction strength (0-100), controlling dispersion and distortion.
refractionProfile'soft' | 'filmic' | 'cinematic''filmic'Applies when background='refraction': refraction style preset.
refractionTone'mist' | 'balanced' | 'vivid''vivid'Applies when background='refraction': refraction tone preset (vivid by default to avoid gray haze).
refractionAnglenumber-24Applies when background='refraction': primary dispersion angle in degrees.
refractionLightFollowMousebooleanfalseApplies when background='refraction': binds the highlight anchor to pointer position.
refractionLightFollowIntensitynumber0.45Applies when background='refraction': pointer follow intensity (0-1), controlling angle/strength coupling.
refractionLightSpringbooleantrueApplies when background='refraction': enables spring interpolation for pointer light tracking.
refractionLightSpringStiffnessnumber0.18Applies when background='refraction': pointer-light spring stiffness (recommended 0.01-0.55).
refractionLightSpringDampingnumber0.84Applies when background='refraction': pointer-light spring damping (recommended 0.55-0.99).
clickablebooleanfalseDescription for clickable.
loadingbooleanfalseDescription for loading.
loadingSpinnerSizenumber-Description for loadingSpinnerSize.
disabledbooleanfalseDescription for disabled.
inertialbooleanfalseDescription for inertial.
inertialMaxOffsetnumber22Description for inertialMaxOffset.
inertialReboundnumber0.12Description for inertialRebound.

Events

EventParamsDescription
click(event: MouseEvent)Description for click.

Slots

ColumnDescription
defaultDescription for default.
headerDescription for header.
footerDescription for footer.
coverDescription for cover.

Style Customization

CSS Variables

EXAMPLE.CSS
.custom-card {
  --tx-card-fake-background: rgba(255, 255, 255, 0.8);
  --tx-card-padding: 24px;
}

Theme Customization

EXAMPLE.CSS
:root {
  /* text */
  --tx-card-background-default: rgba(255, 255, 255, 0.8);
  --tx-card-background-glass: rgba(255, 255, 255, 0.1);
  
  /* text */
  --tx-card-border-default: 1px solid rgba(0, 0, 0, 0.1);
  --tx-card-border-outlined: 1px solid var(--tx-color-border);
  
  /* text */
  --tx-card-shadow-default: 0 2px 8px rgba(0, 0, 0, 0.1);
  --tx-card-shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.15);
  
  /* textSize */
  --tx-card-padding-small: 16px;
  --tx-card-padding-medium: 20px;
  --tx-card-padding-large: 24px;
}

Best Practices

Usage Tips

  1. Content structure: use header/body/footer sections appropriately
  2. Visual hierarchy: use card variants to create hierarchy
  3. Interaction feedback: provide clear feedback for clickable cards
  4. Responsive design: ensure good behavior across screen sizes

Layout Examples

EXAMPLE.VUE
<template>
  <div class="card-grid">
    <TxCard 
      v-for="item in items" 
      :key="item.id"
      clickable
      @click="handleItemClick(item)"
    >
      <template #header>
        <h3>{{ item.title }}</h3>
      </template>
      
      <p>{{ item.description }}</p>
      
      <template #footer>
        <div class="card-actions">
          <TxButton size="small" variant="text">Text</TxButton>
          <TxButton size="small" variant="text">Text</TxButton>
        </div>
      </template>
    </TxCard>
  </div>
</template>

TouchX UI Text Card TextContentText,Text。
Was this helpful?