Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Shadcn Link Overlay for React and Tailwind

Makes the whole card or article clickable.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/link-overlay.json

Usage

import { Button } from "@/components/ui/button";
import {
  Card,
  CardFooter,
  CardHeader,
  CardMedia,
  CardTitle,
} from "@/components/ui/card";
import { LinkBox, LinkOverlay } from "@/components/ui/link-overlay";
<LinkBox asChild>
  <Card className="w-full max-w-xs">
    <CardMedia className="h-32 bg-muted" variant="image" />
    <CardHeader description="This sofa is perfect for modern tropical spaces, baroque inspired spaces.">
      <LinkOverlay asChild>
        <CardTitle asChild>
          <a href="#">Living room Sofa</a>
        </CardTitle>
      </LinkOverlay>
    </CardHeader>
    <CardFooter className="flex-row-reverse gap-2">
      <Button className="flex-1">Buy now</Button>
      <Button className="flex-1" variant="outline">
        Add to cart
      </Button>
    </CardFooter>
  </Card>
</LinkBox>

Accessibility

KeyDescription
Enter
Activate the focused control.
Space
Activate the focused control.

Demos

Article

API Reference

LinkOverlay

a

PropType
AttributeType

div

PropType
AttributeType