Skip to content

shadcn.io is an independent project built on shadcn/ui

Components

Free

3D Pin for Svelte

A card that leans back on hover as a pin of light rises from it to a label. For Svelte with Ark UI, to point at one featured project or place.

UI library: Ark UI

A card that leans back when it's hovered, as if a pin had been dropped on it: a line of light rises from its middle to a label, and rings spread on the ground around it.

Use it to point at one thing on a page: a featured project, a place on a map, the stand people should find. Give it a href and the whole card is one link named by its label. For a card that follows the pointer, use a 3D Card; for a label on an ordinary element, a Tooltip. In Svelte the tilt is a CSS transition and the rings a CSS animation, so nothing else is installed.

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
Use email insteadNo credit card

Anatomy

3D Pin anatomy: root, label, line, card, rings
Pin3D
โ”œโ”€โ”€ link (with href)
โ”œโ”€โ”€ card
โ”‚   โ””โ”€โ”€ children
โ””โ”€โ”€ perspective (shown on hover)
    โ”œโ”€โ”€ label (the title)
    โ”œโ”€โ”€ rings
    โ””โ”€โ”€ line

Usage

<script lang="ts">
import { Pin3D } from "@/components/ui/pin-3d";
</script>
<Pin3D href="/projects/atlas" title="View project">
  <div class="flex size-72 flex-col gap-1">
    <h3 class="font-semibold">Atlas</h3>
    <p class="text-muted-foreground text-sm">Maps for every team.</p>
  </div>
</Pin3D>

Accessibility

With href, a link covers the card and its name is title, so a screen reader hears "View project, link" once rather than every line of the card. Focus it with the keyboard and the card leans back and the pin shows, as on hover. The rings, the line and the label are decoration and hidden from assistive tech. With reduced motion the card stays upright and the rings hold still; the label and the line still show.

Tab
Move focus to the card's link, which shows the pin.
Enter
Follow the link.

Demos

Image

A photo with a caption under it, linked to its trail. The card's padding and border come from Pin3D, so the content is just what goes inside: here a 4:3 image and one line. The label reads View trail, the link's name for a screen reader too, so make it say where the link goes.

Preview width

No href: the card still leans back and shows its pin on hover, but it isn't a link and takes no focus. Use it as a marker on a floor plan or a map, where the pin says "here" and nothing opens. Content inside it, such as a button, stays clickable, since no link covers it.

Preview width

Grid

Two smaller cards side by side, each with its own link and label. Only the hovered one leans back, since each card is its own hover group. Leave room above each card for its label, which sits over the card's top edge.

Preview width

FAQ

Where does the title appear?

In a small pill above the card, at the top of the pin's line, faded in on hover or keyboard focus. Keep it to two or three words, such as View project. It's also the link's accessible name when there's an href. With no title, there's no pill and the line rises to nothing.

How do the rings and the tilt work?

The card's lean is a CSS transition to rotateX(40deg) and 80% scale. The three rings run one CSS animation, 6 seconds long, two seconds apart, and play only while the card is hovered or its link has focus. They lie on a plane turned 70 degrees, which is why they look like ellipses.

What happens with reduced motion in Svelte?

The card doesn't lean and the rings hold still at three sizes, so the reader still sees the label and the pin, without movement. Hover and focus work the same, and the link is the same link.

Can I put buttons inside a 3D Pin?

Only without href. With href the link covers the card so the whole card is one target, and a button under it can't be clicked. If the card needs its own controls, leave href out and put a link among them instead.

How do I install 3D Pin in Svelte?

Run the command in the Installation section on this page. It adds Pin3D to your ui folder and the rings' keyframes, with their animation utility, to your stylesheet. The command uses the shadcn-svelte CLI.

API Reference

Pin3D

<div> data-slot="pin-3d"

PropType
href?string

Where the card goes. With it, the whole card is one link, named by title; without it, the card only shows the pin.

title?string

The label on the pin, shown above the card while it's hovered.

class?string

Merged with the part's classes.

CSS variableType
--pin-3d-ring-stillstring