Ballmac UI home

Desktop Icons

A macOS desktop of icons: box-select with the pointer, drag to move with snapping to grid cells, double-click or Return to open, arrow keys to move focus and Alt plus arrows to move an icon.

Drag icons, drag a box to select, double-click to open.

Installation

$ pnpm dlx shadcn@latest add @ballmac/desktop-icons

Usage

import { DesktopIcons } from "@/components/ballmac/desktop-icons"

The full example is in the Code tab above.

Examples

Icons behind windows

API reference

PropTypeDefault
items*

The icons and where they sit.

DesktopItem[]—
onItemsChange

Called with the new list after icons are dragged to other cells.

(items: DesktopItem[]) => void—
onOpen

Called when an icon is opened with a double-click or Return.

(item: DesktopItem) => void—
cell

Size of one grid cell in pixels.

number96
label

Accessible name of the desktop.

string—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Arrow keysMove focus to the nearest icon in that direction
Alt+ArrowMoves the focused icon one cell
EnterOpens
SpaceToggles selection

Use with AI

<DesktopIcons items={[{ id, name, kind, col, row }]} onItemsChange onOpen cell />. Positions are grid cells. Icons that land on an occupied cell move to the nearest free one. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Desktop Icons (@ballmac/desktop-icons) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Desktop-style demos and playgrounds
  • Launch surfaces with draggable shortcuts

Not for

  • Ordinary file lists (file-browser)

Registry JSON: https://ui.ballmac.com/r/desktop-icons.json

Credits

Free to use in personal and commercial projects.

npm
None