UI.MD

Add Tile

The dashed add-one tile at the end of a row or grid of thumbnails: a plus above a label, and on hover the edge, icon and label turn accent with no fill.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/add-tile.json

Usage

import { AddTile } from "@/components/ui/add-tile"

Examples

Default

Fills its box as a square. Give it the size of the thumbnails beside it.

Menu trigger

It is a plain button, so it works as the trigger of a menu. Change the icon and label to say what it adds.

Drop target

dragOver draws the hover look while a file is held over the tile. You own the drag events.

Loading and disabled

Loading swaps the icon for a spinner and ignores clicks, but stays in the tab order.

API Reference

PropTypeDefaultDescription
labelReact.ReactNode-The text under the icon. Default Add. For an icon-only tile pass aria-label too.
iconIconProp-Shown above the label. Default is a plus.
loadingboolean-Swaps the icon for a spinner and ignores clicks.
dragOverboolean-Draws the hover look while a file is dragged over the tile, and sets data-drag-over.
...propsReact.ComponentProps<"button">-Every other button prop and the ref are forwarded. Size it with className (size-24).
labelReact.ReactNodeThe text under the icon. Default Add. For an icon-only tile pass aria-label too.
iconIconPropShown above the label. Default is a plus.
loadingbooleanSwaps the icon for a spinner and ignores clicks.
dragOverbooleanDraws the hover look while a file is dragged over the tile, and sets data-drag-over.
...propsReact.ComponentProps<"button">Every other button prop and the ref are forwarded. Size it with className (size-24).