Breakpoints
Tailwind's default breakpoints, which of them the components use, and how to build layouts that work from 320px to 1920px.
Silkware does not define its own breakpoints. It uses Tailwind's defaults, and layouts are written mobile first: the base classes are the small layout, and a prefix adds to it from that width up. Every page must work from 320px to 1920px with no horizontal scroll.
Window is at: basesm, 640px and upmd, 768px and uplg, 1024px and upxl, 1280px and up2xl, 1536px and up
The breakpoints
| Prefix | Minimum width | Media query |
|---|---|---|
| (none) | 0 | All widths |
sm | 640px | min-width: 640px |
md | 768px | min-width: 768px |
lg | 1024px | min-width: 1024px |
xl | 1280px | min-width: 1280px |
2xl | 1536px | min-width: 1536px |
What the components use
The shadcn components in components/ui use only two breakpoints, sm and md, and container queries (@container) for parts that depend on the width of their own parent, such as the card header and the field group. For example, the sidebar turns into a drawer below md, input text goes from 16px to 14px at md, and dialog footers go from a column to a row at sm.
Your own layouts may use any of the six. Prefer sm, md and lg, which cover phone, tablet and laptop.
What the theme changes at a width
Two values in globals.css change at widths of their own, not Tailwind's:
| Width | Change |
|---|---|
| Below 640px | --step-display is 40px, --step-lead is 16px and the lead's line height is 1.65. |
| Below 1240px | --header-height is 64px instead of 72px. |
Spacing and the large type steps are fluid with clamp(), so they need no breakpoint at all. See Spacing.
Responsive behaviour
Start with the layout for a phone and add what a wider screen can afford. A form stacks on a phone and sits in a row from md:
<form className="flex flex-col gap-4 md:flex-row md:items-end">Below 640px everything runs full width. A page has one pair of margins at every width (px-page), so the layout never needs a different margin per breakpoint.
Write the phone layout first and add what a wider screen can afford.
Open this order on a larger screen to confirm the supplier.
Don’t hide an action on a small screen.
Test at 320px, 375px, 768px, 1280px and 1920px, in light and dark.
Related
- Spacing for fluid layout tokens.
- Responsive design for the working rules.