Card
A neo-brutalist card container supporting 6 variants and composable sub-components for structured content presentation.
Demo
默认
卡片标题
卡片描述信息。
这是卡片内容区域,可以放置文本、图片或其他组件。
变体
默认
标准阴影
提升
更大阴影
扁平
无阴影
交互式
悬停查看效果
主要
主要颜色边框和阴影
次要
次要颜色边框和阴影
内边距
内边距: 无
内边距: 小
内边距: 默认
内边距: 大
纹理与装饰(texture / deco)
蓝图网格 + HUD 准星
点阵纹理
Installation
pnpm dlx brutx-vue@latest add cardUsage
<script setup>
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Button } from 'brutx-ui-vue'
</script>
<template>
<Card variant="default">
<CardHeader>
<CardTitle>Payment Method</CardTitle>
<CardDescription>Add a new payment method to your account.</CardDescription>
</CardHeader>
<CardContent>
<p>Card content goes here.</p>
</CardContent>
<CardFooter>
<Button variant="primary">Save</Button>
</CardFooter>
</Card>
</template>Variants
| Variant | Description |
|---|---|
default | Standard shadow |
elevated | Large shadow for emphasis |
flat | No shadow |
interactive | Shadow with hover lift effect and pointer cursor |
primary | Primary color shadow and border |
secondary | Secondary color shadow and border |
Texture & Decoration
texture provides background dot/grid patterns and deco adds a HUD decoration layer; both stack with any variant:
| Prop | Values | Description |
|---|---|---|
texture | none / grid / dots | Background texture: blueprint grid / dot matrix (background-image based, never conflicts with background color) |
deco | none / hud | Four-corner crosshair decoration layer (pseudo-element based, industrial calibration feel) |
<template>
<Card variant="interactive" texture="grid" deco="hud">
<CardTitle>HUD Monitor Panel</CardTitle>
</Card>
</template>Padding
| Padding | Value |
|---|---|
none | p-0 |
sm | p-3 |
default | p-5 |
lg | p-8 |
Template Recipes
Compose new card templates directly from the Card sub-components.
Article Card
<Card variant="interactive" padding="none">
<CardHeader>
<Badge variant="accent" size="sm">Vue 3</Badge>
<CardTitle>Getting Started with BrutxUI</CardTitle>
<CardDescription>Build bold interfaces with composable primitives.</CardDescription>
</CardHeader>
<CardFooter>
<Button variant="link">Read more</Button>
</CardFooter>
</Card>File Card
<Card>
<CardHeader>
<CardTitle>report-2026.pdf</CardTitle>
<CardDescription>PDF · 3.2 MB</CardDescription>
</CardHeader>
<CardFooter>
<Button variant="outline" size="sm">Download</Button>
</CardFooter>
</Card>Testimonial Card
<Card variant="elevated">
<CardContent>
<p class="font-bold">“This product changed our workflow.”</p>
</CardContent>
<CardFooter>
<span class="text-sm font-black">Alex Chen · Product Manager</span>
</CardFooter>
</Card>Sub-components
| Component | Description |
|---|---|
Card | Root container, supports variant and padding props |
CardHeader | Header area with bottom padding |
CardTitle | Bold title text with letter spacing |
CardDescription | Muted description text |
CardContent | Main content area |
CardFooter | Footer area with flex layout |
API Reference
Card
| Name | Type | Default | Description |
|---|---|---|---|
variant | "accent-subtle" | "default" | "destructive-subtle" | "elevated" | "flat" | "info-subtle" | "interactive" | "primary-subtle" | "primary" | "secondary-subtle" | "secondary" | "success-subtle" | undefined | "default" | Controls the card color, shadow, or interactive appearance; the interactive variant also enables interactive semantics. |
DetailsDeclared typeNonNullable<"flat" | "default" | "interactive" | "primary" | "secondary" | "primary-subtle" | "secondary-subtle" | "success-subtle" | "info-subtle" | "accent-subtle" | "elevated" | "destructive-subtle" | null | undefined> | undefined Literal values
Default value details
Sourcepackages/ui/src/components/card/Card.vue | |||
padding | "default" | "lg" | "none" | "sm" | undefined | "default" | The preset padding for the card content area. |
DetailsDeclared typeNonNullable<"default" | "lg" | "sm" | "none" | null | undefined> | undefined Literal values
Default value details
Sourcepackages/ui/src/components/card/Card.vue | |||
texture | "dots" | "grid" | "none" | undefined | undefined | A background texture layered over the card color: blueprint grid or halftone dots. |
DetailsDeclared typeNonNullable<"none" | "grid" | "dots" | null | undefined> | undefined Literal values
Default value details
Sourcepackages/ui/src/components/card/Card.vue | |||
deco | "hud" | "none" | undefined | undefined | An optional HUD-style four-corner crosshair decoration, for visual presentation only. |
DetailsDeclared typeNonNullable<"none" | "hud" | null | undefined> | undefined Literal values
Default value details
Sourcepackages/ui/src/components/card/Card.vue | |||
interactive | boolean | undefined | false | Makes the card respond to clicks and Enter/Space, adding button semantics and keyboard focus. |
DetailsDeclared typeboolean | undefined Literal values
Default value details
Sourcepackages/ui/src/components/card/Card.vue | |||
disabled | boolean | undefined | false | Disables focus and activation for an interactive card and sets aria-disabled. |
DetailsDeclared typeboolean | undefined Literal values
Default value details
Sourcepackages/ui/src/components/card/Card.vue | |||
class | string | undefined | undefined | CSS classes added to the card root container. |
DetailsDeclared typestring | undefined Default value details
Sourcepackages/ui/src/components/card/Card.vue | |||
| Name | Signature or type | Description |
|---|---|---|
@activate | [event: Event] | Emits the native event when an interactive card is activated by the primary click, Enter, or Space. It is suppressed when disabled or when the event originates from a nested interactive element. |
DetailsDeclared type[event: Event] Sourcepackages/ui/src/components/card/Card.vue | ||
| Name | Signature or type | Description |
|---|---|---|
#default | {} | Card body content, commonly composed with CardHeader, CardContent, and CardFooter. |
DetailsDeclared type{}Sourcepackages/ui/src/components/card/Card.vue | ||
CardContent
| Name | Type | Default | Description |
|---|---|---|---|
class | string | undefined | — | CSS classes added to the card main-content region. |
DetailsDeclared typestring | undefined Default value details
Sourcepackages/ui/src/components/card/CardContent.vue | |||
| Name | Signature or type | Description |
|---|---|---|
#default | {} | Card body content rendered in the main-content region. |
DetailsDeclared type{}Sourcepackages/ui/src/components/card/CardContent.vue | ||
CardDescription
| Name | Type | Default | Description |
|---|---|---|---|
class | string | undefined | — | CSS classes added to the description text element. |
DetailsDeclared typestring | undefined Default value details
Sourcepackages/ui/src/components/card/CardDescription.vue | |||
| Name | Signature or type | Description |
|---|---|---|
#default | {} | Supplementary descriptive text for the card. |
DetailsDeclared type{}Sourcepackages/ui/src/components/card/CardDescription.vue | ||
CardHeader
| Name | Type | Default | Description |
|---|---|---|---|
class | string | undefined | — | CSS classes added to the card header region. |
DetailsDeclared typestring | undefined Default value details
Sourcepackages/ui/src/components/card/CardHeader.vue | |||
| Name | Signature or type | Description |
|---|---|---|
#default | {} | Card header content, commonly a title and description. |
DetailsDeclared type{}Sourcepackages/ui/src/components/card/CardHeader.vue | ||
CardTitle
| Name | Type | Default | Description |
|---|---|---|---|
as | "h2" | "h3" | "h5" | "h1" | "h4" | "h6" | undefined | "h3" | Selects which HTML heading element from h1 through h6 renders the title. |
DetailsDeclared type"h2" | "h3" | "h5" | "h1" | "h4" | "h6" | undefined Literal values
Default value details
Sourcepackages/ui/src/components/card/CardTitle.vue | |||
class | string | undefined | undefined | CSS classes added to the heading element. |
DetailsDeclared typestring | undefined Default value details
Sourcepackages/ui/src/components/card/CardTitle.vue | |||
| Name | Signature or type | Description |
|---|---|---|
#default | {} | Card title text or inline heading content. |
DetailsDeclared type{}Sourcepackages/ui/src/components/card/CardTitle.vue | ||
Accessibility
- Semantic structure:
CardTitlerenders as anh3heading element by default, customizable to an appropriate heading level via theasprop - Interactive feedback: The
interactivevariant provides hover effects; it is recommended to use it with keyboard focus styles - Clickable cards: Setting the
interactiveprop (or usingvariant="interactive") addsrole="button"andtabindex="0"to the card, with Enter/Space key support to trigger theactivateevent (dispatching native event parameter) - Disabled state: An
interactivecard withdisabledis not focusable (tabindex="-1"), is markedaria-disabled="true", and neither clicks nor keys triggeractivate; visually, the pointer cursor and hover/press interaction styles are no longer applied, distinguishing it from interactive cards - Nested interactive elements: Clicks on, or Enter/Space key presses on, interactive elements nested inside the card (buttons/links) do not trigger the card
activate(consistent withonClickbehavior, avoiding double-firing of "child action + card activation"); also avoid nesting interactive elements inside aninteractivecard, which would create invalid ARIA nesting - Content organization: The
CardHeader,CardContent, andCardFootersub-components provide a clear content structure, making it easier for assistive technologies to understand the page layout
Clickable Card
Use the interactive prop to make a card clickable, automatically adding pointer cursor and hover lift effect:
<script setup>
import { Card, CardContent, CardTitle } from 'brutx-ui-vue'
function handleClick(event) {
console.log('Card activated!', event)
}
</script>
<template>
<Card interactive @activate="handleClick">
<CardContent>
<CardTitle>Click me!</CardTitle>
<p>This card is interactive and supports keyboard navigation.</p>
</CardContent>
</Card>
</template>