Bonusway design system

Layout

Grid

Responsive columns, declared mobile-first: `cols` applies from the smallest screen and `sm`/`md`/`lg`/`xl` override upward at 640 / 768 / 1024 / 1280px.

import Grid from '@/components/ui/Grid';

Source: src/components/ui/Grid.tsx

Examples

Mobile-first columns

cols={1} md={2} lg={4} means one column on phones, two from md, four from lg. Skip a breakpoint and the count below it simply holds: cols={1} sm={2} lg={3} xl={4} is two columns all the way through the tablet range. Narrow the stage above to watch it change — that is what the width toggle is for.

1
2
3
4

Available counts

1, 2, 3, 4, 5, 6 and 12 — a fixed set, so a grid can’t end up at 7 columns.

2
2
3
3
3
6
6
6
6
6
6

Props

<Grid> props

PropTypeDefaultDescription
asElementType'div'—
cols1 | 2 | 3 | 4 | 5 | 6 | 121—
sm1 | 2 | 3 | 4 | 5 | 6 | 12——
md1 | 2 | 3 | 4 | 5 | 6 | 12——
lg1 | 2 | 3 | 4 | 5 | 6 | 12——
xl1 | 2 | 3 | 4 | 5 | 6 | 12——
gapLayoutGap'md'—
childrenrequiredReactNode——

Also accepts everything in HTMLAttributes<HTMLElement> — so native attributes (id, onClick, aria-*, data-*) pass straight through.

Usage

Do

  • Declare the phone case in `cols` and widen from there.
  • `xl` is the last column a grid can gain: the page container is `max-w-screen-xl`, so nothing widens past 1280px.

Don’t

  • Don’t use a Grid for a single row of buttons — that is a Row.
  • Don’t hand-write `grid-cols-*` alongside it; the props and the classes will disagree at some breakpoint.

Ta strona używa plików cookies

Używamy plików cookie, aby poprawić jakość użytkowania
oraz funkcjonowanie naszej strony i dostosować treści, których Ci dostarczamy. Niezbędne pliki cookie są konieczne do prawidłowego działania naszego serwisu. Jeśli wyrażasz zgodę na gromadzenie przez nas informacji o Tobie za pomocą niezbędnych i marketingowych plików cookie, kliknij „Zaakceptuj wszystko”. Zawsze możesz zmienić swoje preferencje, odwiedzając Ustawienia plików cookie.

Ustawienia cookies