Skip to content

Grid

As many equal columns as fit. Give it the narrowest a cell may be; it decides how many columns there are on each screen.

import { Grid } from '@sypnia/ui/react'

On this page
  1. Cards that reflow
  2. When to use it
  3. For everyone
  4. Props

Cards that reflow

min="14rem": four columns on a wide screen, two on a tablet, one on a phone, with no media query.

Code
import { Card, Grid, NewCard } from '@sypnia/ui/react';

const projects = [
  ['Checkout', 'Payments and orders', '3 problems'],
  ['Search', 'The search service', 'All well'],
  ['Mobile app', 'iOS and Android', '1 problem'],
  ['Billing', 'Invoices and plans', 'All well'],
];
export default function Cards() {
  return (
    <Grid min="14rem" gap={4}>
      {projects.map(([name, text, meta]) => <Card key={name} title={name} meta={meta} href="#">{text}</Card>)}
      <NewCard href="#">New project</NewCard>
    </Grid>
  );
}

When to use it

Use it when

  • Cards, tiles, stats or pictures that are all alike.
  • The number of columns should follow the width of the screen.

Do not use it when

  • You need exactly two or three columns, whatever the width: that is Columns.
  • The items have different sizes on purpose: lay them out with Columns or Split.

For everyone

  • Cells keep the reading order of the code, left to right and top to bottom.

Props

GridTypeDefault
as ElementType div
className string
gap Gap
id string
min

The narrowest a cell may get before the grid uses one column less.

string
style CSSProperties
  1. Cards that reflow
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms