WlCard
Appearance
Team structure, roles and agreements.
Set padding to none, sm (8 px), md (12 px) or lg (16 px). Each section uses one inset; the caption has no bottom inset. Omit the prop to keep the theme defaults.
Full example
<script setup lang="ts">
import { WlButton, WlCard } from "legato-ui";
import { ref } from "vue";
const saved = ref(false);
</script>
<template>
<div class="wl-stack" data-space="md">
<WlCard >
<template #title>{{ "Team guide" }}</template>
<template #subtitle>{{ "Updated October 1" }}</template>
<p class="wl-text-body">{{ "Team structure, roles and agreements." }}</p>
<template #footer>
<WlButton size="sm" @click="saved = !saved">{{ saved ? "Saved" : "Save" }}</WlButton>
</template>
</WlCard>
<p class="wl-text-small">{{ "Set padding to none, sm (8 px), md (12 px) or lg (16 px). Each section uses one inset; the caption has no bottom inset. Omit the prop to keep the theme defaults." }}</p>
<WlCard
v-for="padding in (['none', 'sm', 'md', 'lg'] as const)"
:key="padding"
:padding="padding"
:data-padding-example="padding"
>
<template #title>padding="{{ padding }}"</template>
{{ "Team structure, roles and agreements." }}
<template #footer>{{ "Updated October 1" }}</template>
<WlCard v-if="padding === 'lg'" padding="none" data-padding-example="nested">
{{ "This nested card keeps its own padding." }}
</WlCard>
</WlCard>
</div>
</template>Regular and hoverable cards
Header, title/subtitle, content and footer in a responsive grid; separate accessible actions.
Sprint 24
Three tasks in review, demo on Friday.
Product note
Hoverable changes the hover appearance. A separate button performs the action.
Choose a card action.
Full example
<script setup lang="ts">
import { WlButton, WlCard, WlTag } from "legato-ui";
import { ref } from "vue";
const opened = ref("");
</script>
<template>
<div class="wl-stack" data-space="lg">
<div class="showcase-cards">
<WlCard aria-labelledby="showcase-card-sprint">
<template #title>
<h3 id="showcase-card-sprint" class="wl-text-subheading">{{ "Sprint 24" }}</h3>
</template>
<template #subtitle>{{ "Teamwork · 8 tasks" }}</template>
<p class="wl-text-body">{{ "Three tasks in review, demo on Friday." }}</p>
<template #footer>
<WlButton size="sm" variant="soft" @click="opened = 'Sprint 24'">
{{ "Open board" }}
</WlButton>
<span class="wl-text-small wl-text-muted">{{ "Updated today" }}</span>
</template>
</WlCard>
<WlCard hoverable aria-labelledby="showcase-card-note">
<template #header>
<div class="showcase-card-banner"><WlTag color="blue">{{ "Team material" }}</WlTag></div>
</template>
<template #title>
<h3 id="showcase-card-note" class="wl-text-subheading">{{ "Product note" }}</h3>
</template>
<template #subtitle>{{ "Next release plan" }}</template>
<p class="wl-text-body">{{ "Hoverable changes the hover appearance. A separate button performs the action." }}</p>
<template #footer>
<WlButton size="sm" @click="opened = 'Product note'">{{ "Read note" }}</WlButton>
<WlTag color="green">{{ "New" }}</WlTag>
</template>
</WlCard>
</div>
<p class="wl-text-small" role="status">{{ opened ? "Opened: " + opened : "Choose a card action." }}</p>
</div>
</template>
<style scoped>
.showcase-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--wl-space-lg); }
.showcase-card-banner { padding: var(--wl-space-lg); background: var(--wl-accent-soft); }
</style>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
hoverable | boolean | false | Highlight on hover. |
pt | WlPt< | Not set | Attributes of internal Legato UI elements. |
as | "section" | | Not set | Root element when no link destination is supplied. |
href | string | Not set | Link destination; selects WlLink as the root. |
to | unknown | Not set | Router destination handled by the configured WlLink adapter. |
variant | "outlined" | | Not set | Outline or elevation treatment; omission uses the theme default. |
padding | "none" | | Not set | Content padding; omission uses the theme default. |
Events
No public events.
Slots
| Slot | Type / values | Content |
|---|---|---|
default | — | Main content. |
header | — | Header for an image or banner. |
title | — | Title. |
subtitle | — | Subtitle. |
footer | — | Footer. |
Pass-through: pt
Sections WlCard are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
root | button / a | The root section in WlConfig.pt.card configuration. |
header | div.wl-card__header | The header section in WlConfig.pt.card configuration. |
body | div.wl-card__body | The body section in WlConfig.pt.card configuration. |
caption | div.wl-card__caption | The caption section in WlConfig.pt.card configuration. |
title | div.wl-card__title | The title section in WlConfig.pt.card configuration. |
subtitle | div.wl-card__subtitle | The subtitle section in WlConfig.pt.card configuration. |
content | div.wl-card__content | The content section in WlConfig.pt.card configuration. |
footer | div.wl-card__footer | The footer section in WlConfig.pt.card configuration. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- Card, Accordion, Alert and Segmented expose component font-size, line-height, font-weight and font-family tokens. Defaults retain 1.0 typography. Import styles/primitives.css and add wl-type-scale to opt into semantic roles; the mapping table and live toggle are in Typography → Scale. Set local scale values on the same group, or override a component token on a closer element. Select and MultiSelect use the font size of each role. To scale a local dropdown, pass the class and role values through pt.overlay.
- padding controls caption, content and footer once. none removes their insets; sm/md/lg use 8/12/16 px. The header stays full bleed, and nested cards keep their own settings. Without the prop, the existing section insets are preserved.
- The title slot does not create a heading itself: use a suitable h2/h3 and the card's aria-labelledby if needed.
- Hoverable changes appearance on hover. Add a link or button inside the card for navigation or actions.
- Keep header, title/subtitle, content and footer in a logical order; do not combine nested interactive areas into one button.
Keyboard and application responsibilities
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesIn your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.