Skip to content

Search documentation

Search guides, examples, and component APIs.

Quick links
↑↓ NavigateEnter OpenEsc Close
Get started

Documentation navigation

Components / Display

Card

A composable surface for related content and actions.

Last changed in version 0.13.0: Add avatar groups and chips, expand the block gallery, and improve component colors, spacing, and motion.

Interactive showcase

default

Card variant

Card content

outline

Card variant

Card content

muted

Card variant

Card content

Install

Run in your project
bunx --bun @getweini/cli@latest add card

Start with this example

Import the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.

Workspace

Updated just now

Your content
Vue
<script setup lang="ts">
import Card from './components/ui/card/Card.vue'
import CardContent from './components/ui/card/CardContent.vue'
import CardDescription from './components/ui/card/CardDescription.vue'
import CardHeader from './components/ui/card/CardHeader.vue'
import CardTitle from './components/ui/card/CardTitle.vue'
</script>

<template>
  <Card as="article">
    <CardHeader>
      <CardTitle>Workspace</CardTitle>
      <CardDescription>Updated just now</CardDescription>
    </CardHeader>
    <CardContent>Your content</CardContent>
  </Card>
</template>

Compose CardHeader, CardTitle, CardDescription, CardContent, and CardFooter as needed.

When to use it

Settings summary

Group an account setting, its explanation, and an edit action in one surface.

Dashboard metric

Give a small set of related figures a clear title and supporting context.

More examples

Settings card

Put the action in the footer so the content remains easy to scan.

Settings card
<script setup lang="ts">
import Button from './components/ui/button/Button.vue'
import Card from './components/ui/card/Card.vue'
import CardContent from './components/ui/card/CardContent.vue'
import CardDescription from './components/ui/card/CardDescription.vue'
import CardFooter from './components/ui/card/CardFooter.vue'
import CardHeader from './components/ui/card/CardHeader.vue'
import CardTitle from './components/ui/card/CardTitle.vue'
</script>

<template>
  <Card as="section" variant="outline">
    <CardHeader>
      <CardTitle as="h2">Email notifications</CardTitle>
      <CardDescription>Choose which updates reach your inbox.</CardDescription>
    </CardHeader>
    <CardContent>Weekly summaries are enabled.</CardContent>
    <CardFooter><Button variant="outline">Edit preferences</Button></CardFooter>
  </Card>
</template>

Compact metric

A smaller card can show a single measure without another nested container.

Compact metric
<script setup lang="ts">
import Card from './components/ui/card/Card.vue'
import CardContent from './components/ui/card/CardContent.vue'
import CardDescription from './components/ui/card/CardDescription.vue'
import CardHeader from './components/ui/card/CardHeader.vue'
import CardTitle from './components/ui/card/CardTitle.vue'
</script>

<template>
  <Card as="article" size="sm" variant="muted">
    <CardHeader>
      <CardTitle as="h2">Open issues</CardTitle>
      <CardDescription>Across active projects</CardDescription>
    </CardHeader>
    <CardContent><strong>12</strong></CardContent>
  </Card>
</template>

Complete API

Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.

Card

Complete API for Card
NameType or signatureDefaultWhat it does
asprop"div" | "section" | "article" | undefined"div"Choose the HTML element or Vue component used for this control.
variantprop"default" | "outline" | "muted" | undefined"default"Choose the visual treatment for this component.
sizeprop"sm" | "md" | "lg" | undefined"md"Choose the visual size. Medium is the usual default where available.
defaultslot() => unknownRequiredContent shown inside Card.
elementexposedHTMLElement | null—Reference to the underlying HTML element.

CardContent

Complete API for CardContent
NameType or signatureDefaultWhat it does
defaultslot() => unknownRequiredContent shown inside CardContent.

CardDescription

Complete API for CardDescription
NameType or signatureDefaultWhat it does
defaultslot() => unknownRequiredContent shown inside CardDescription.

CardFooter

Complete API for CardFooter
NameType or signatureDefaultWhat it does
defaultslot() => unknownRequiredContent shown inside CardFooter.

CardHeader

Complete API for CardHeader
NameType or signatureDefaultWhat it does
defaultslot() => unknownRequiredContent shown inside CardHeader.

CardTitle

Complete API for CardTitle
NameType or signatureDefaultWhat it does
asprop"h2" | "h3" | "h4" | "h5" | "h6" | undefined"h3"Choose the HTML element or Vue component used for this control.
defaultslot() => unknownRequiredContent shown inside CardTitle.
Public type definitions
Public types
// packages/frameworks/vue/components/card/types.ts
// ------- IMPORTS -------

import type { cardSizes, cardVariants } from './styles'

// ------- TYPES -------

export interface CardProps {
  as?: 'div' | 'section' | 'article'
  variant?: keyof typeof cardVariants
  size?: keyof typeof cardSizes
}

export interface CardTitleProps {
  as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
}


// packages/frameworks/vue/components/card/styles.ts
// Change Card surface and spacing here; public visual types follow these keys.
export const cardVariants = {
  default: 'border-border bg-card text-card-foreground shadow-card',
  outline: 'border-border bg-card text-card-foreground',
  muted: 'border-transparent bg-muted text-foreground',
} as const

export const cardSizes = { sm: 'gap-4 p-4', md: 'gap-6 p-6', lg: 'gap-8 p-8' } as const

Implementation notes

  • Choose section or article for a meaningful document region; the default div is suitable for purely visual grouping.
  • Use one card per related subject, and keep actions next to the content they affect.

Accessibility and localization

  • Use CardTitle with a heading level that fits the surrounding page outline.

Source contract and editing guidance