@molecule/app-card-grid-solid
Feature · card-grid · App (browser) · v1.1.1 · Apache-2.0
Responsive Solid card grid and bento-grid layouts
npm install @molecule/app-card-grid-solidHow it works
@molecule/app-card-grid-solid is a ready-made card-grid feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { BentoGrid, CardGrid } from '@molecule/app-card-grid-solid'
export function Grids() {
return (
<div>
<CardGrid columns={3} gap="md">
<ProductCard product={products[0]} />
<ProductCard product={products[1]} />
<ProductCard product={products[2]} />
</CardGrid>
<BentoGrid
items={[
{ id: 'hero', content: <HeroCard />, colSpan: 8, rowSpan: 2 },
{ id: 'stats', content: <StatsCard />, colSpan: 4 },
]}
/>
</div>
)
}Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid
Reference
Solid card-grid and bento-grid layouts.
Exports:
CardGrid— responsive grid with configurable column count.BentoGrid— col/row-span or named-areas layout for mixed-size cards.
This is the Solid counterpart of @molecule/app-card-grid-react: the same
exports, the same props (React names), and the same DOM for the same input.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { BentoGrid, CardGrid } from '@molecule/app-card-grid-solid'
export function Grids() {
return (
<div>
<CardGrid columns={3} gap="md">
<ProductCard product={products[0]} />
<ProductCard product={products[1]} />
<ProductCard product={products[2]} />
</CardGrid>
<BentoGrid
items={[
{ id: 'hero', content: <HeroCard />, colSpan: 8, rowSpan: 2 },
{ id: 'stats', content: <StatsCard />, colSpan: 4 },
]}
/>
</div>
)
}
Type
feature
Installation
npm install @molecule/app-card-grid-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
API
Interfaces
BentoItem
Data descriptor for a single cell in a BentoGrid layout.
interface BentoItem {
/** Unique item identifier (Solid's `<For>` identity is the array entry). */
id: string
/** Card content (React's `ReactNode`: a JSX element or text). */
content: JSX.Element
/** CSS grid-column-span (1-12). Defaults to 4. */
colSpan?: number
/** CSS grid-row-span (1-6). Defaults to 1. */
rowSpan?: number
/** Named grid-area when using `areas` layout. */
area?: string
}
BentoGridProps
Props for BentoGrid.
interface BentoGridProps {
/** Items to render. */
items: BentoItem[]
/**
* Optional `grid-template-areas` string (e.g. `'a a b' 'c d d'`). When
* provided, each `BentoItem.area` must match a token in the template.
*/
areas?: string
/** Default column count when `areas` is absent. Defaults to 12. */
columns?: number
/** Gap between items. */
gap?: 'xs' | 'sm' | 'md' | 'lg'
/** Extra classes. */
className?: string
}
CardGridProps
Props for CardGrid.
interface CardGridProps {
/** Cards. */
children: JSX.Element
/** Column count at the md+ breakpoint. 1–6. Defaults to 3. */
columns?: 1 | 2 | 3 | 4 | 5 | 6
/** Gap between cards. */
gap?: 'xs' | 'sm' | 'md' | 'lg'
/** Extra classes. */
className?: string
}
Functions
BentoGrid(props)
Bento-style grid — items span multiple cells for a magazine / dashboard
layout. Works in two modes: (a) col/row-span driven, (b) named-areas
driven via the areas prop.
This is the Solid counterpart of @molecule/app-card-grid-react's
BentoGrid: the same props (React names), the same ClassMap tokens, and the
same DOM for the same input. Solid's style object takes hyphenated CSS
property names, which DOM setProperty requires.
function BentoGrid(props: BentoGridProps): JSX.Element
props— Component props (seeBentoGridProps).
Returns: The rendered bento grid.
CardGrid(props)
Generic responsive card grid. Collapses to one column on narrow viewports
and grows to columns on md+. Typical uses: product grids, post grids,
dashboard widget rows.
This is the Solid counterpart of @molecule/app-card-grid-react's
CardGrid: the same props (React names), the same ClassMap tokens, and the
same DOM for the same input.
function CardGrid(props: CardGridProps): JSX.Element
props— Component props (seeCardGridProps).
Returns: The rendered card grid.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-solid^3.5.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-solid^1.1.0solid-js^1.8.0
Runtime Dependencies
@molecule/app-solid@molecule/app-ui@molecule/app-ui-solidsolid-js
CardGrid collapses to one column on narrow viewports and grows to
columns (1–6) at the md+ breakpoint via the ClassMap grid. In
BentoGrid, span mode uses a columns-wide grid (default 12) with
per-item colSpan/rowSpan; passing areas switches to named
grid-template-areas — then every item must set a matching area
token or it falls out of the template.