SwipeUI
DocsGuides

Responsive layouts

Adapt native components and compositions to iPhone, iPad, landscape and large text.

Size each component from its containing surface. An iPad can have a narrow app window, and a card can occupy a narrow column inside a wide screen.

Measure the container

Install the free responsive-layout utility through the CLI. Attach its onLayout handler to the available container. Before measurement the layout is compact; selection and form state should survive later width changes.

components/adaptive-content.tsx
import { View } from 'react-native';
import { useResponsiveLayout } from '@/components/swipeui/lib/responsive-layout';

export function AdaptiveContent() {
  const layout = useResponsiveLayout();
  // Lay content out with layout.columns.
  return <View onLayout={layout.onLayout} style={{ flex: 1, padding: layout.gutter }} />;
}

Compact layouts have less than 600pt available width, medium layouts have 600–899pt, and expanded layouts have at least 900pt. Grids use up to one, two or three columns with 16pt gaps and at least 280pt per column. Large text reduces the number of columns. Forms and reading content stay centered with a maximum width of 672pt.

Keep controls usable

Let text wrap and actions stack. Use minimum heights for controls containing text, keep font scaling enabled, and preserve 44×44pt touch targets. Media keeps its aspect ratio. Keep horizontal scrolling for collections that intentionally move horizontally.

Screen roots handle safe areas once. Forms scroll focused fields above the keyboard. Overlays fit their presentation bounds, and anchors must be measured again after resizing or keyboard changes. Native sheets keep their platform engine's behavior.

Verify real layouts

The preview width selector provides compact, landscape and tablet browser examples. Browser previews do not certify native layout, Dynamic Type, keyboard behavior or VoiceOver. Native iPhone/iPad verification remains pending for the current milestone, including resized iPad windows, rotation and bare Uniwind runtime compatibility.

On this page