Components
Interactive Card
A card that behaves as one interactive surface with keyboard support.
Installation
$ npx veil-ui@latest add interactive-cardUsage
import { InteractiveCard } from "@/components/ui/interactive-card";
<InteractiveCard onClick={() => {}}>Open settings</InteractiveCard>;Examples
Basic
Team settings
Manage members, roles and billing.
Open settings
Disabled
Archived workspace
This workspace is read-only.
API reference
The package exports interactive-card along with its composable parts. It forwards standard attributes to its root element; see the examples above for the component-specific props.
Accessibility
- Content uses semantic HTML — lists are lists, tables are tables and metadata uses a definition list.
- Interactive elements are real buttons or links with visible focus states.
- Images require meaningful
alttext; icons used decoratively arearia-hidden.
Vue and plain HTML
This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add interactive-card --framework vue or switch the framework in components.json.
<script setup lang="ts">
import { Card } from "@/components/ui/card";
import { cn } from "@/lib/utils";
const props = defineProps<{
disabled?: boolean;
class?: string;
}>();
const emit = defineEmits<{ click: [event: MouseEvent] }>();
function onClick(event: MouseEvent) {
if (!props.disabled) emit("click", event);
}
function onKeydown(event: KeyboardEvent) {
if (props.disabled) return;
if (event.key === "Enter" || event.key === " ") {
event.preventDefault();
(event.currentTarget as HTMLElement).click();
}
}
</script>
<template>
<Card
data-slot="interactive-card"
:data-disabled="disabled || undefined"
:role="disabled ? undefined : 'button'"
:tabindex="disabled ? undefined : 0"
:aria-disabled="disabled || undefined"
:class="
cn(
'cursor-pointer transition-colors hover:border-ring/60 hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
disabled && 'cursor-not-allowed opacity-60 hover:border-border hover:bg-card',
props.class,
)
"
@click="onClick"
@keydown="onKeydown"
>
<slot />
</Card>
</template>