Skip to content

Card

WxCard — a surface that groups a block of an admin screen: a form, a table, a summary.

Page settings
Draft

Cards group a form, a table or any block of an admin screen.

With a sidebar

The sidebar column keeps its width until the card itself drops below 560px — then the two columns stack.

Body-only card, shadow on hover.
Compact
Bordered with small padding.

Usage

vue
<template>
  <wx-card title="Page settings" shadow="always">
    <template #extra>Draft</template>

    <wx-input v-model="title" placeholder="Title" />

    <template #footer>
      <wx-button type="primary">Save</wx-button>
    </template>
  </wx-card>
</template>

The header is rendered only when title, #header or #extra is present; the footer only when #footer is.

Props

PropTypeDefaultDescription
titlestringHeader text; ignored if #header is used
shadow'never' | 'hover' | 'always''always'When the card casts a shadow
padding'none' | 'sm' | 'md' | 'lg''md'Padding of header, body and footer
borderedbooleanfalseAdds an outline; cards separate by shadow

Slots

SlotDescription
defaultCard body
headerReplaces the title
extraRight-hand side of the header (badge, actions)
sidebarNarrow column beside the body — see below
footerFooter, separated from the body by the card's own padding

Filling #sidebar splits the body into a narrow column and the main content — the usual shape for an entity screen with a preview, a status panel or a section menu next to the form.

vue
<template>
  <wx-card title="Page">
    <template #sidebar>
      <wx-input model-value="" placeholder="Search sections" size="sm" />
    </template>

    <p>Main content.</p>
  </wx-card>
</template>

The columns stack when the card itself is narrower than 560px — a container query, not a viewport one, so a card dropped into a narrow column collapses even on a wide screen.

Width is a variable, 240px by default:

vue
<template>
  <wx-card style="--wx-card-sidebar-width: 320px">…</wx-card>
</template>

Styling

padding sets a local --wx-card-padding, so a single card can be adjusted without touching the global scale:

vue
<template>
  <wx-card style="--wx-card-padding: 28px">Custom padding</wx-card>
</template>

Released under the MIT License.