# Clickable Card

A keyboard-accessible card that behaves as one action.

A keyboard-accessible card that behaves as one action.

```tsx
import { ClickableCard, Stack, Text } from "@zentara-co/zenos-ui";
import { useState } from "react";

function ClickableCardExample() {
  const [lastOpened, setLastOpened] = useState("None");

  return (
    <Stack gap="3" className="w-full max-w-2xl">
      <Stack direction="row" gap="3" wrap="wrap" align="stretch">
        <ClickableCard
          label="Open workspace"
          className="min-w-56 flex-1"
          onClick={() => setLastOpened("Workspace")}
        >
          <ClickableCard.Header>
            <ClickableCard.Title>Workspace</ClickableCard.Title>
            <ClickableCard.Description>View project activity.</ClickableCard.Description>
          </ClickableCard.Header>
        </ClickableCard>
        <ClickableCard
          label="Open audit log"
          variant="grey"
          className="min-w-56 flex-1"
          onClick={() => setLastOpened("Audit log")}
        >
          <ClickableCard.Header>
            <ClickableCard.Title>Audit log</ClickableCard.Title>
            <ClickableCard.Description>Review security events.</ClickableCard.Description>
          </ClickableCard.Header>
        </ClickableCard>
        <ClickableCard
          label="Open reports"
          variant="white"
          className="min-w-56 flex-1"
          onClick={() => setLastOpened("Reports")}
        >
          <ClickableCard.Header>
            <ClickableCard.Title>Reports</ClickableCard.Title>
            <ClickableCard.Description>Browse saved reports.</ClickableCard.Description>
          </ClickableCard.Header>
        </ClickableCard>
        <ClickableCard
          variant="white"
          label="Unavailable report"
          disabled
          className="min-w-56 flex-1"
        >
          <ClickableCard.Header>
            <ClickableCard.Title>Compliance report</ClickableCard.Title>
            <ClickableCard.Description>Available after the first scan.</ClickableCard.Description>
          </ClickableCard.Header>
        </ClickableCard>
      </Stack>
      <Text className="text-sm text-text-subtle" aria-live="polite">
        Last opened: {lastOpened}
      </Text>
    </Stack>
  );
}
```

## Import

```tsx
import { ClickableCard } from "@zentara-co/zenos-ui";
```

## Anatomy

ClickableCard reuses the Card compound parts, including `ClickableCard.Media`. A visually hidden native button (or link when `href` is set) owns activation; clicking the card surface forwards to that control unless the event target is another interactive element.

```tsx
<ClickableCard label="Open workspace" onClick={handleOpen}>
  <ClickableCard.Media>{/* photo or video */}</ClickableCard.Media>
  <ClickableCard.Header>
    <ClickableCard.Title>Workspace</ClickableCard.Title>
    <ClickableCard.Description>View project activity.</ClickableCard.Description>
  </ClickableCard.Header>
</ClickableCard>
```

## Media

`ClickableCard.Media` uses the same inset frame as [Card.Media](/components/card/#media). The card stays one action, so leave buttons out of the frame. A badge laid over the picture is decorative and still activates the card.

```tsx
import { Badge, ClickableCard, Stack, Text } from "@zentara-co/zenos-ui";
import { useState } from "react";

function ClickableCardMediaExample() {
  const [lastOpened, setLastOpened] = useState("None");

  return (
    <Stack gap="3" className="w-full">
      <Stack direction="row" gap="4" wrap="wrap" align="start" className="w-full justify-center">
        <ClickableCard
          label="View interior kit"
          className="w-full max-w-72"
          onClick={() => setLastOpened("Interior kit")}
        >
          <ClickableCard.Media>
            <img
              src="https://images.unsplash.com/photo-1616486338812-3dadae4b4ace?auto=format&fit=crop&w=800&q=80"
              alt="Living room with plants and a rust-colored chair"
            />
            <Badge variant="solid" color="neutral" rounded className="absolute start-2 top-2">
              Best seller
            </Badge>
          </ClickableCard.Media>
          <ClickableCard.Header>
            <ClickableCard.Title>Interior kit</ClickableCard.Title>
            <ClickableCard.Description>
              48 rooms, 6 moods, every one editable.
            </ClickableCard.Description>
          </ClickableCard.Header>
        </ClickableCard>
        <ClickableCard
          label="Open mountain retreat"
          className="w-full max-w-72"
          onClick={() => setLastOpened("Mountain retreat")}
        >
          <ClickableCard.Header>
            <ClickableCard.Title>Mountain retreat</ClickableCard.Title>
            <ClickableCard.Description>Media can close the card too.</ClickableCard.Description>
          </ClickableCard.Header>
          <ClickableCard.Media>
            <img
              src="https://images.unsplash.com/photo-1469474968028-56623f02e42e?auto=format&fit=crop&w=800&q=80"
              alt="Sunlit mountain valley above a green cliff"
            />
          </ClickableCard.Media>
        </ClickableCard>
      </Stack>
      <Text className="text-sm text-text-subtle" aria-live="polite">
        Last opened: {lastOpened}
      </Text>
    </Stack>
  );
}
```

## Variants and states

`variant` accepts the same values as [Card](/components/card/): `default` (neutral card fill), `grey` (accent gray subtlest fill), and `white`. White cards use `background-default` in light mode and match the default card's `background-neutral-card` in dark mode. Hover and press use the active theme's gray fills.

Disabled cards use muted background and border, `opacity-50`, and muted title and description text. They expose `aria-disabled` and cannot be activated.

The preview above shows default, grey, and white cards plus a disabled example.

## Link card

Provide `href` when activation represents navigation. The hidden control becomes a native link with your `label` as its accessible name, while visible content keeps the Card layout.

```tsx
import { ClickableCard } from "@zentara-co/zenos-ui";

function ClickableCardLinkExample() {
  return (
    <ClickableCard
      label="Read the workspace documentation"
      href="#clickable-card-api"
      className="w-full max-w-md"
    >
      <ClickableCard.Header>
        <ClickableCard.Title>Workspace documentation</ClickableCard.Title>
        <ClickableCard.Description>Navigate using native link semantics.</ClickableCard.Description>
      </ClickableCard.Header>
      <ClickableCard.Content>Open the API reference on this page.</ClickableCard.Content>
    </ClickableCard>
  );
}
```

## Custom styling

Add `className` on the root to define your own surface, border, and hover or active fills. Classes merge after the built-in interactive styles, so you can replace default hover colors with token-based utilities such as `hover:bg-background-accent-teal-subtlest-hover`.

Style `ClickableCard.Title` and `ClickableCard.Description` when the root uses a strong accent fill. Focus ring and keyboard activation behavior are unchanged.

```tsx
import { ClickableCard } from "@zentara-co/zenos-ui";

function ClickableCardCustomExample() {
  return (
    <ClickableCard
      label="Open campaign workspace"
      className="w-full max-w-md border-border-accent-teal-default bg-background-accent-teal-subtlest-default hover:bg-background-accent-teal-subtlest-hover active:bg-background-accent-teal-subtlest-pressed"
      onClick={() => undefined}
    >
      <ClickableCard.Header>
        <ClickableCard.Title className="text-text-accent-teal-bolder">
          Campaign workspace
        </ClickableCard.Title>
        <ClickableCard.Description className="text-text-accent-teal-bolder/80">
          Custom hover and press fills on the root replace the default neutral treatment.
        </ClickableCard.Description>
      </ClickableCard.Header>
    </ClickableCard>
  );
}
```

## ClickableCard or another component

Use ClickableCard for a single primary action or navigation target on the card surface. Use [SelectableCard](/components/selectable-card/) when users toggle or choose among options. Use [Card](/components/card/) for read-only content.

## Anatomy

```text
ClickableCard.Root
ClickableCard.Header
ClickableCard.Title
ClickableCard.Description
ClickableCard.Action
ClickableCard.Content
ClickableCard.Media
ClickableCard.Footer
```

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| label | string | — | Accessible name for the card's primary action. |
| href | string | — | Uses native link semantics for the primary action. |
| onClick | MouseEventHandler<HTMLElement> | — | Runs for pointer, Enter, and Space activation. |
| disabled | boolean | false | Prevents activation and applies muted, reduced-opacity styling. |
| variant | default \| grey \| white | default | Card surface; hover and press fills match the chosen variant. |
| className | string | — | Merged last on the root. Override surface, border, and hover or active fills with semantic tokens. |
| native props | React.HTMLAttributes<HTMLDivElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

`label` names the card's primary button or link for assistive technology. Use `href` for navigation and `onClick` for an action. Nested controls remain independently interactive and do not activate the card. Disabled cards expose `aria-disabled` and cannot be activated.

Source: https://zenos-ui.pages.dev/components/clickable-card/