Skip to content

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.

Brevia Torino

4 orders wait on Giulia

Brevia Brescia

12 orders in transit

Brevia Bologna

Quality checks done

Breakpoints

Silkware uses Tailwind's default breakpoints. The theme does not define custom ones.

PrefixFromTypical change
none0One column, full width, the page margin only.
sm640pxTwo columns for short items. Dialogs stop filling the width. Buttons sit side by side.
md768pxThe sidebar appears. Navigation moves out of the sheet. Inputs drop to the smaller text size.
lg1024pxThree columns. A secondary panel opens beside the content.
xl1280pxThe wide layout.
2xl1536pxMore air, not more columns.
  • Write styles for the small screen with no prefix and add sm:, md: and lg: to change them upward. A max- 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 (useIsMobile in hooks/use-mobile.ts), and the type steps and the header height change at 640px and 1240px in app/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.

TokenUtilityFromTo
--pad-xpx-page20px64px
--guttergap-gutter16px24px
--section-padpy-section56px120px
--stack-gapgap-stack40px64px
--title-gapgap-title24px24px
--header-heighth-header64px below 1240px72px above
  • Use px-page for the page margin at every width, and gap-gutter between columns. Do not write px-4 md:px-8.
  • Use py-section between 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.

StepSize
text-display40px below 640px, then about 49px to 83px by width
text-statement20px to 30px
text-lead16px 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-docs preset 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

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.
WidthWhat to do
Under 768pxOne navigation, behind a trigger. A Sidebar sheet, or a Navigation Menu in a sheet.
768px and upThe sidebar or the navigation menu is visible.
AnyBreadcrumb 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.
AnyKeep 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.

OrderSupplierSiteOwnerDeliveryTotal
PO-2417BulloviaBergamoGiulia14 Dec 2026€18,420
PO-2416Ferrolva AcciaiBresciaLuca12 Dec 2026€52,300
PO-2415PlastrenaPadovaMarco9 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 sm for 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

ComponentOn a phoneOn a desktop
DialogFills the width minus a 1rem margin on each side.A window 28rem wide (sm:max-w-md), centred.
Alert DialogThe same.The same. A confirmation is short and stays a dialog.
SheetThree quarters of the width from the side, or the full width from the bottom.At most 24rem wide from the side.
DrawerA 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-controls to 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-controls for a screen used with a mouse and on phones (sign-in, forms, settings), plain touch-controls for a region that only exists in the phone layout (a mobile menu sheet), max-md:touch-controls for a region that becomes its phone form below a breakpoint (a sidebar sheet). Turn it back off inside with touch-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-11 to reach 44px. It changes the mouse layout as well; touch-controls keeps 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 showOnHover on 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 :hover itself, such as [&>a:hover]:underline, is not gated: use hover: 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 sets viewport-fit=cover in 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.
Do

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

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-*.

Do

Let a wide table scroll inside its own container and keep the page still.

Don’t

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.

WidthWhy
320pxThe narrowest phone. Nothing may overflow or clip.
375pxThe common phone. The smoke checks use this width.
768pxA tablet, and where the sidebar appears.
1280pxA laptop.
1920pxA 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

  1. Is it one column at 320px, in reading order?
  2. Do all actions stay visible and reachable without hover?
  3. Does the page itself never scroll sideways?
  4. Are sizes steps and tokens, not pixels?
  5. Does a table scroll inside its own container, and does it have a short first column?
  6. Does an overlay fit in the height of a landscape phone?