Link cursor
Pan board
Busy
Controls
A playful pixel-art cursor provider with arrow, hover, click, text, zoom, panning and status states.
Component
import { Button, CursorProvider, CursorDock } from "@swirski/ui";Controls
<CursorProvider
className="relative min-h-72 overflow-hidden border-4 border-black bg-[#F5F5F3] p-6"
cursor="bolt"
storageKey={false}
>
<CursorDock position="absolute" side="right" />
<div className="flex min-h-48 flex-col justify-center gap-5">
<Button tone="yellow">Hover me</Button>
<Button className="w-fit" href="#preview" tone="white">
Link cursor
</Button>
<div className="grid gap-3 sm:grid-cols-3">
<div
className="grid min-h-20 place-items-center border-4 border-black bg-[#0057FF] p-3 text-center font-black uppercase text-white"
data-cursor="pan"
>
Pan board
</div>
<div
aria-busy="true"
className="grid min-h-20 place-items-center border-4 border-black bg-[#FFD400] p-3 text-center font-black uppercase"
>
Busy
</div>
<button
className="min-h-20 border-4 border-black bg-neutral-200 p-3 font-black uppercase text-black/50"
disabled
type="button"
>
Locked
</button>
</div>
</div>
</CursorProvider>| Prop | Type | Default | Notes |
|---|---|---|---|
CursorDock.label | string | "Choose cursor" | Accessible label for the dock trigger. |
CursorDock.position | 'fixed' | 'absolute' | "fixed" | Positions the dock against the viewport or parent. |
CursorDock.side | 'left' | 'right' | "right" | Side where the cursor dock opens. |
CursorDock.size | 'md' | "md" | Generated from CursorDockProps. |
CursorDock.tone | 'default' | "default" | Generated from CursorDockProps. |
CursorDock.variant | 'default' | "default" | Generated from CursorDockProps. |
CursorPicker.buttonTabIndex | number | - | Generated from CursorPickerProps. |
CursorPicker.label | string | "Cursor" | Generated from CursorPickerProps. |
CursorPicker.showLabels | boolean | true | Generated from CursorPickerProps. |
CursorPicker.size | 'md' | "md" | Generated from CursorPickerProps. |
CursorPicker.tone | 'default' | "default" | Generated from CursorPickerProps. |
CursorPicker.variant | 'default' | "default" | Generated from CursorPickerProps. |
CursorProvider.childrenRequired | ReactNode | - | Content that should receive the Swirski cursor styles. |
CursorProvider.cursor | CursorId | - | Controlled cursor id. |
CursorProvider.cursors | SwirskiCursor[] | swirskiCursors | Custom cursor sets. Optional fields can supply pointer, active, disabled, text, zoom, grab, grabbing, busy and status cursor assets. |
CursorProvider.defaultCursor | CursorId | "bolt" | Initial cursor when the provider is uncontrolled. |
CursorProvider.onCursorChange | ((cursorId: CursorId) => void) | - | Generated from CursorProviderProps. |
CursorProvider.size | 'md' | "md" | Generated from CursorProviderProps. |
CursorProvider.storageKey | string | false | "swirski-cursor" | Local storage key, or false to skip persistence. |
CursorProvider.tone | 'default' | "default" | Generated from CursorProviderProps. |
CursorProvider.variant | 'default' | "default" | Generated from CursorProviderProps. |
data-cursor | "pointer" | "active" | "disabled" | "text" | "zoom-in" | "zoom-out" | "pan" | "grab" | "grabbing" | "move" | "resize" | "copy" | "crosshair" | "help" | "progress" | "wait" | "not-allowed" | - | Opts any descendant into a specific cursor state. Tailwind cursor utility classes are recognized too. |