FragiolaGrid Layout

@fragiola/grid-layout · React

Dashboards that move, and not a line of CSS from us.

A headless grid layout: items that drag and resize on a grid, push each other out of the way and settle. The keyboard and right-to-left come built in, and how it looks is up to you.

Drag a card, pull a corner, try another theme:
Theme
See the code →

What it never ships

  • CSS
  • Icons
  • Handles you cannot restyle
  • Text
  • A design system

The state is exposed as data-* attributes and ARIA, so any styling solution works: Tailwind, plain CSS, CSS modules, CSS-in-JS. The examples use Fragiola UI and its palettes.

A layout is plain data

Items are objects in grid units. Render them how you like; the grid places them and moves them.

dashboard.tsx
const layout = [
    { id: "revenue", x: 0, y: 0, w: 4, h: 2 },
    { id: "orders", x: 4, y: 0, w: 4, h: 2, minW: 2 },
    { id: "banner", x: 8, y: 0, w: 4, h: 1, static: true },
];

<GridLayout.Root defaultLayout={layout} onLayoutChange={save}>
    <GridLayout.Items>
        {(item) => <GridLayout.Item itemId={item.id}>{item.id}</GridLayout.Item>}
    </GridLayout.Items>
</GridLayout.Root>