GridResponsiveCard
Component for defining custom card layouts in responsive mode.
Renders a <tbw-grid-responsive-card> custom element in the light DOM that
the ResponsivePlugin picks up to render custom cards in mobile/narrow layouts.
import { DataGrid, GridResponsiveCard } from '@toolbox-web/grid-react';import { ResponsivePlugin } from '@toolbox-web/grid/all';
function EmployeeGrid() { const config = { plugins: [new ResponsivePlugin({ breakpoint: 500 })], // ... other config };
return ( <DataGrid rows={employees} gridConfig={config}> <GridResponsiveCard cardRowHeight={80}> {({ row, index }) => ( <div className="employee-card"> <img src={row.avatar} alt="" /> <div> <strong>{row.name}</strong> <span>{row.department}</span> </div> </div> )} </GridResponsiveCard> </DataGrid> );}How it works
Section titled “How it works”- This component renders a
<tbw-grid-responsive-card>element in the grid’s light DOM - The ReactGridAdapter detects this element and creates a card renderer
- When the grid enters responsive mode, the plugin calls your render function for each row
- The React component is rendered into the card container
GridResponsiveCard(props: GridResponsiveCardProps<TRow>): ReactElementParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
props | GridResponsiveCardProps<TRow> |
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt