Card

Display content in a card with a header, body and footer.

Usage

<template>
  <UCard>
    <template #header>
      <Placeholder class="h-8" />
    </template>

    <Placeholder class="h-32" />

    <template #footer>
      <Placeholder class="h-8" />
    </template>
  </UCard>
</template>

API

Props

Prop Default Type
as

'div'

any

The element or component this component should render as.

ui

Partial<{ root: string; header: string; body: string; footer: string; }>

Slots

Slot Type
header

{}

default

{}

footer

{}

Theme

app.config.ts
export default defineAppConfig({
  ui: {
    card: {
      slots: {
        root: 'bg-[var(--ui-bg)] ring ring-[var(--ui-border)] divide-y divide-[var(--ui-border)] rounded-[calc(var(--ui-radius)*2)] shadow-sm',
        header: 'p-4 sm:px-6',
        body: 'p-4 sm:p-6',
        footer: 'p-4 sm:px-6'
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    vue(),
    ui({
      ui: {
        card: {
          slots: {
            root: 'bg-[var(--ui-bg)] ring ring-[var(--ui-border)] divide-y divide-[var(--ui-border)] rounded-[calc(var(--ui-radius)*2)] shadow-sm',
            header: 'p-4 sm:px-6',
            body: 'p-4 sm:p-6',
            footer: 'p-4 sm:px-6'
          }
        }
      }
    })
  ]
})