Skip to content

Media Grid

DisplayMIT
View in Storybook

Image / media tile grid with hover details and aspect-ratio preserved.

bun add @otfdashkit/ui

Preview

Media Grid
Loading Storybook preview…

Code

import { Image, Folder } from 'lucide-react'
import { GridList, GridListItem } from '@otfdashkit/ui'

export function Example() {
  return (
    <div className="w-full max-w-2xl">
      <GridList minItemWidth={120} gap={0.75}>
        {Array.from({ length: 12 }).map((_, i) => (
          <GridListItem key={i} interactive className="aspect-square flex items-center justify-center">
            {i % 3 === 0 ? <Image className="h-6 w-6 text-muted-foreground" /> : <Folder className="h-6 w-6 text-muted-foreground" />}
          </GridListItem>
        ))}
      </GridList>
    </div>
  )
}

Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.

Props

Props declared in the GridList source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
gapnumber1Gap between items in rem (default 1 = 16px)
minItemWidthnumber240Minimum width per item (px). Columns fill to that, then reflow.