Bonusway design system

Layout

Stack

Vertical rhythm: children in a column, separated by one gap from the scale.

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

Source: src/components/ui/Stack.tsx

Examples

The gap scale

xs 5 / sm 10 / md 20 / lg 40. The same four values everywhere, which is what keeps two unrelated pages looking like the same product.

gap="xs"

1
2
3

gap="sm"

1
2
3

gap="md"

1
2
3

gap="lg"

1
2
3

Alignment

stretch by default, which is what a form wants — every field the same width. center for a hero, start for a list of chips.

stretch

Short
A longer one

start

Short
A longer one

center

Short
A longer one

end

Short
A longer one

As a list

`as` changes the element without changing the layout — a Stack of list items should be a real <ul>, or a screen reader announces nothing about how many there are.

  • First item
  • Second item

Props

<Stack> props

PropTypeDefaultDescription
asElementType'div'—
gap'xs' | 'sm' | 'md' | 'lg''md'

Vertical space between children. Defaults to the 20px gutter.

align'start' | 'center' | 'end' | 'stretch''stretch'—
childrenrequiredReactNode——

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

Usage

Do

  • Reach for it before writing `flex flex-col gap-*` by hand.

Don’t

  • Don’t mix it with margins on the children — pick one spacing mechanism.

Related:RowGrid

Šī lapa lieto sīkfailus

Mēs izmantojam sīkfailus, lai uzlabotu tavu pieredzi mūsu vietnē un pielāgotu saturu, ko mēs tev piedāvājam. Būtiski sīkfaili ir nepieciešami, lai mūsu pakalpojums darbotos pareizi. Ja esi priecīgs, ka mēs apkopojam informāciju, izmantojot mārketinga sīkdatnes, tad izvelies “Pieņemt visu”. Vienmēr vari mainīt minētos iestatījumus, apmeklējot sīkfailu iestatījumus.

Sīkfailu iestatījumi