Responsive design
How Silkware layouts adapt from a 320px phone to a 1920px monitor without a second design.
A Silkware screen is one design that bends, not a desktop design with a phone version. Every layout works from 320px to 1920px with no horizontal scroll. The rules below say where it bends, what the tokens do on their own, and how to pick the right component for a small screen.
Design for the narrowest width first, as a single column in reading order, and add columns as space allows.
4 orders wait on Giulia
12 orders in transit
Quality checks done
Breakpoints
Silkware uses Tailwind's default breakpoints. The theme does not define custom ones.
| Prefix | From | Typical change |
|---|---|---|
| none | 0 | One column, full width, the page margin only. |
sm | 640px | Two columns for short items. Dialogs stop filling the width. Buttons sit side by side. |
md | 768px | The sidebar appears. Navigation moves out of the sheet. Inputs drop to the smaller text size. |
lg | 1024px | Three columns. A secondary panel opens beside the content. |
xl | 1280px | The wide layout. |
2xl | 1536px | More air, not more columns. |
- Write styles for the small screen with no prefix and add
sm:,md:andlg:to change them upward. Amax-prefix is for the rare exception. - Two breakpoints in the system are set by code and CSS, not by your classes. The Sidebar switches to a sheet below 768px (
useIsMobileinhooks/use-mobile.ts), and the type steps and the header height change at 640px and 1240px inapp/globals.css. - Use a container query where a component sits in a column of unknown width. The Field component does:
orientation="responsive"places the label and control side by side when the field group is wide, and stacks them when it is narrow, whatever the screen width.
The layout tokens
The page grows and shrinks through fluid tokens, so you do not write a different margin at each width. They are Tailwind spacing utilities.
| Token | Utility | From | To |
|---|---|---|---|
--pad-x | px-page | 20px | 64px |
--gutter | gap-gutter | 16px | 24px |
--section-pad | py-section | 56px | 120px |
--stack-gap | gap-stack | 40px | 64px |
--title-gap | gap-title | 24px | 24px |
--header-height | h-header | 64px below 1240px | 72px above |
- Use
px-pagefor the page margin at every width, andgap-gutterbetween columns. Do not writepx-4 md:px-8. - Use
py-sectionbetween sections and nothing else. See Information hierarchy. - Inside a component, use the Tailwind scale. The tokens are for the page.
Type across screens
The standard steps, text-xs to text-6xl, are fixed sizes. A page title is 24px on a phone and on a desktop, so an application screen never reflows its hierarchy. Only a landing page needs a title that grows with the window, and for that the editorial steps are fluid with clamp(), so a heading shrinks as the screen does and never wraps into a tall column.
| Step | Size |
|---|---|
text-display | 40px below 640px, then about 49px to 83px by width |
text-statement | 20px to 30px |
text-lead | 16px below 640px, then 18px |
On a page that is not a landing page, step the size with a breakpoint where a title needs to be larger on a wide screen, for example text-3xl sm:text-4xl for a landing section title.
Orders that wait on you
Four orders wait for Giulia today.
The oldest is PO-2417 from Bullovia.
Open an order to see its lines, its delivery date and who has already looked at it.
- Do not set a type size in pixels in a component. Use a step.
- Running text is 16px at every width, and inside Typeset the
typeset-docspreset holds it there on a phone. Application body text is 14px, the size components use. Inputs use 16px text below 768px (text-base md:text-sm), which stops iOS from zooming in when one is focused. - Keep a line to 45 to 75 characters. On a wide screen, limit the width of the text block and leave the rest empty.
How layout patterns adapt
Sidebar to sheet
Below 768px the Sidebar stops being a column and opens as a Sheet from the side, 18rem wide, behind a trigger. Put a SidebarTrigger in the header so the person can open it.
- Keep every destination of the sidebar in the sheet. Do not make a phone version with fewer sections.
- Keep the active item marked and put the most used sections first, since the person reads the list from the top on a narrow screen.
- Ctrl B (Command B on a Mac) opens and closes it at every width.
Navigation
| Width | What to do |
|---|---|
| Under 768px | One navigation, behind a trigger. A Sidebar sheet, or a Navigation Menu in a sheet. |
| 768px and up | The sidebar or the navigation menu is visible. |
| Any | Breadcrumb wraps onto a second line when it is too long. On a narrow screen, collapse the middle with BreadcrumbEllipsis and keep the current page and its parent. |
| Any | Keep Tabs to three or four short labels, so the list fits a phone. Test the longest label at 320px. |
Tables on small screens
The Table component wraps its table in a container that scrolls sideways (overflow-x-auto), so a wide table never makes the page scroll. This is the default and it works for tables that people compare.
| Order | Supplier | Site | Owner | Delivery | Total |
|---|---|---|---|---|---|
| PO-2417 | Bullovia | Bergamo | Giulia | 14 Dec 2026 | €18,420 |
| PO-2416 | Ferrolva Acciai | Brescia | Luca | 12 Dec 2026 | €52,300 |
| PO-2415 | Plastrena | Padova | Marco | 9 Dec 2026 | €7,860 |
- Keep the first column, the one that names the row, short, so the person always knows which row they are in as they scroll.
- Put the columns that matter first. A column pushed off the right edge is a column that is not read.
- Give the table
min-w-*so its columns keep a readable width and the container scrolls, instead of squeezing the text. - If people do not compare rows on a phone, show a list of Items there and the table from
md. Render one at a time, not both hidden by CSS, so a screen reader does not read it twice.
Forms
- One column on a phone. Two columns from
smfor short related fields, such as supplier and site. Never three. - Labels sit above fields. Use
orientation="responsive"on a Field where a label and control can sit side by side in a wide container. - Actions stack on a phone and sit in a row from
sm. The primary action is last in both, so the order of reading is the order of the code. - Use the right input type (
type="email",inputMode="numeric") so the phone shows the right keyboard.
Dialogs, sheets and drawers
| Component | On a phone | On a desktop |
|---|---|---|
| Dialog | Fills the width minus a 1rem margin on each side. | A window 28rem wide (sm:max-w-md), centred. |
| Alert Dialog | The same. | The same. A confirmation is short and stays a dialog. |
| Sheet | Three quarters of the width from the side, or the full width from the bottom. | At most 24rem wide from the side. |
| Drawer | A panel from the bottom that the person can swipe away. | A drawer is rarely the right choice. Use a Sheet or a Popover. |
- Use a Dialog for a short task and a Sheet or Drawer for a longer one. A long form in a dialog is a page that has been put in a window.
- Keep the title and the actions of a dialog visible: do not let a tall dialog push its buttons off the screen. A task that needs more than a screen of height deserves a page.
- A popover with more than two controls is too big for a phone. Use a sheet from the bottom there.
Touch targets and hover
- Controls keep their shipped size on every device. Where a screen or a region is meant for fingers, add
touch-controlsto it and its controls reach--touch-target, 44px; checkboxes, radios, switches and nested icon buttons get a 44px hit area. See Sizing. - Pick the condition with a variant:
pointer-coarse:touch-controlsfor a screen used with a mouse and on phones (sign-in, forms, settings), plaintouch-controlsfor a region that only exists in the phone layout (a mobile menu sheet),max-md:touch-controlsfor a region that becomes its phone form below a breakpoint (a sidebar sheet). Turn it back off inside withtouch-controls-off. - Use it on primary and submit actions, sign-in and one-time code screens, bottom bars, mobile navigation and filters in a sheet. Leave compact what is compact on a phone too: row actions in a dense table, chips, inline controls.
- Sheets, menus, selects and dialogs open outside the page, so give their content the class as well.
- Design a touch region with 44px rows in mind: a toolbar of five icon buttons is 220px, a calendar month is 332px wide.
- Do not add
h-11to reach 44px. It changes the mouse layout as well;touch-controlskeeps the size in one token. - Text fields are 16px on a touch screen everywhere, scope or not, so iOS does not zoom in when one takes focus. Do not set a field below 16px on a phone.
- Never hide an action behind hover. Anything that appears on hover must also appear on focus and be reachable on a touch screen. Do not use the sidebar’s
showOnHoveron a screen meant for tablets: its actions stay hidden until hover or focus from 768px up. - Tooltips and hover cards do not open on a tap, so a label or detail that matters is written, not hovered.
- Hover effects belong to a pointer. Tailwind’s
hover:only applies where the device can hover, so a tap does not leave a hover fill. An arbitrary variant that writes:hoveritself, such as[&>a:hover]:underline, is not gated: usehover:instead. - A bar fixed to the bottom of the screen pads itself with
env(safe-area-inset-bottom)so it clears the home indicator, as the settings block’s save bar does:pb-[max(--spacing(3),env(safe-area-inset-bottom))]. The value is 0 until your app setsviewport-fit=coverin its viewport. - The on-screen keyboard covers a bar fixed to the bottom while a field has focus. Keep the save action reachable without the bar, or hide the bar while typing.
Stack the actions on a phone and put them in a row from sm: flex flex-col gap-2 sm:flex-row sm:justify-end, with the buttons at w-full sm:w-auto.
Don’t give an element a fixed pixel width such as w-[480px]. It overflows every screen narrower than that. Use w-full with max-w-*.
Let a wide table scroll inside its own container and keep the page still.
Don’t let the page scroll sideways. A page with horizontal scroll is a defect at every width.
Test from 320 to 1920
Check each screen at these widths, in light and dark.
| Width | Why |
|---|---|
| 320px | The narrowest phone. Nothing may overflow or clip. |
| 375px | The common phone. The smoke checks use this width. |
| 768px | A tablet, and where the sidebar appears. |
| 1280px | A laptop. |
| 1920px | A large monitor. Text must not run past 75 characters. |
- Use the screenshot script to check overflow:
node scripts/screenshot.mjs /your/page .screenshots/page.png --full --dark --width 375. It prints console errors and horizontal overflow and the overflow must be zero. - Scale the browser's text to 200 percent at 1280px. The layout should reflow as it does on a phone.
- Rotate to landscape on a phone. Fixed headers and bottom sheets must still leave room for content.
- Resize slowly across 640px, 768px and 1240px. These are where the layout changes.
Check a screen
- Is it one column at 320px, in reading order?
- Do all actions stay visible and reachable without hover?
- Does the page itself never scroll sideways?
- Are sizes steps and tokens, not pixels?
- Does a table scroll inside its own container, and does it have a short first column?
- Does an overlay fit in the height of a landscape phone?