Custom Shadcn Icon Tile for React and Tailwind CSS. Shadcn Icon Tile that wraps an icon in a consistent square surface for list rows, feature cards, and empty states.
import { FolderIcon } from "lucide-react"
import { IconTile } from "@/components/byosui/icon-tile"
Browse 17 production-ready Shadcn Icon Tile components for dashboards, forms, and product UI. These examples follow the Radix UI implementation with accessible primitives from the Radix stack and stay fully compatible with Shadcn Create so radius, color, and typography match your configured theme.
Browse all 17 Shadcn Icon Tile components for copy-ready layouts, dashboards, and forms built with Tailwind CSS in the ReUI library.
IconTile is a shadcn-compatible byosui primitive that gives an icon a square
surface with a consistent size, radius, and border treatment. Use it for list
row media, feature cards, settings rows, empty states, and any place where a
bare glyph needs a container to sit in.
The tile sizes its own child svgs, so you do not pass a size class to the icon
in the common case. Keep meaningful labels in the surrounding copy and mark
purely decorative tiles with aria-hidden="true".
IconTile renders a single element (a span by default) that centers its
children on a sized, rounded surface. There are no sub-components. Everything
the tile draws is derived from CSS variables set on that root, so a tile can be
retuned from one className without extra wrappers.
Implementation dependencies: radix-ui and class-variance-authority.
<IconTile variant="elevated">
<PackageIcon />
</IconTile>Each size sets the tile box, the glyph size, and the inset shared by the
soft and frame variants together, so the proportions hold at every step.
<IconTile size="lg" variant="frame">
<FolderIcon />
</IconTile>radius="default" follows the active style radius, so a tile matches the rest
of the installed style. radius="full" makes the tile circular.
<IconTile radius="full">
<FolderIcon />
</IconTile>The tile composes through asChild, backed by the Radix Slot, so it can
become a link, a button, or any other element while keeping its surface styles
and data attributes.
<IconTile asChild className="hover:bg-accent">
<a href="/settings" aria-label="Open settings">
<Settings2Icon aria-hidden="true" />
</a>
</IconTile>The root carries data attributes for styling and for test selectors.
The root sets four variables, so a single className can retune the whole tile
without touching the icon.
There are three ways to step outside the size scale, and they can be combined.
A plain utility on the tile. A size-* class in className wins over the
primitive's size-(--icon-tile-size) through tailwind-merge, so the tile box
changes while the glyph keeps the size from the size prop.
<IconTile variant="elevated" className="size-14">
<ImageIcon />
</IconTile>A size-* class directly on the child icon. Child svgs are auto-sized with
[&_svg:not([class*=size-])]:size-(--icon-tile-icon-size), so an icon that
already carries a size-* class opts out of the tile's glyph sizing.
<IconTile className="size-14">
<ImageIcon className="size-7" />
</IconTile>The CSS variables. Setting --icon-tile-size and --icon-tile-icon-size
keeps the tile and glyph in step and needs no class on the icon. The soft
and frame inset stays on the value from the size prop, so set
--icon-tile-inset too when such a tile moves far from its scale step.
<IconTile className="[--icon-tile-icon-size:--spacing(7)] [--icon-tile-size:--spacing(14)]">
<Settings2Icon />
</IconTile>For color, reach for the soft or solid variant and set a single text color
class; both derive their fills and borders from currentColor. Any variant can
also be recolored directly through className, as the brand-color example does
by overriding the elevated fill with a Tailwind color.
<IconTile variant="soft" className="text-success">
<CircleCheckIcon />
</IconTile>All native span props are supported.
import { IconTile } from "@/components/byosui/icon-tile"
import { FolderIcon } from 'lucide-react'
export function Pattern() {
return (
<div className="flex items-center justify-center">
<IconTile aria-hidden="true">
<FolderIcon />
</IconTile>
</div>
)
}