Canvas ring
The absolutely-positioned ring drawn around a canvas card when it is
selected or being dragged. It is shared by
canvas-card, document-card and
folder-card so the selection and drag visuals stay in
lockstep across every card type.
Layout & grids
The ring is drawn just outside the card. Toggle the variant to compare the selection and drag colours.
The selection variant uses --canvas-selection; the drag variant uses
--canvas-drag-ring. Both come from canvas-vars, so the
ring follows your theme automatically.
Installation
npx shadcn@latest add https://canvas.blode.co/r/canvas-ring.jsonUsage
Render it inside a relative container, the ring positions itself with
inset, so a negative value pulls it just outside the card. Drive active from
your selection or drag state.
import { CanvasRing } from "@/components/canvas/canvas-ring";
<div className="relative rounded-2xl border bg-background p-5">
<CanvasRing active={selected} inset={-4} thickness={2} />
{/* card content */}
</div>;To match the drag affordance instead, switch the variant:
<CanvasRing active={isDragging} variant="drag" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| active* | boolean | — | Render the ring. When false, nothing is drawn. |
| variant | "selection" | "drag" | "selection" | `selection` uses the marquee colour, `drag` the drag-ring colour. |
| inset | number | -6 | Inset in px (negative pulls the ring outside the card). |
| thickness | number | 2.5 | Border thickness in px. |
| radius | number | 20 | Corner radius in px. |