Split screen
Also called split layout, split view, or two-pane layout
A layout that divides the screen into two side-by-side panels, each with its own content, sometimes with a divider you drag to resize.
import { useState, type ReactNode } from 'react';
const MIN = 25; // percent of the width for each pane
const STEP = 5;
type Props = { left: ReactNode; right: ReactNode };
export function SplitView({ left, right }: Props) {
const [split, setSplit] = useState(
() => Number(localStorage.getItem('split')) || 50
);
function resize(next: number) {
const value = Math.min(100 - MIN, Math.max(MIN, next));
setSplit(value);
localStorage.setItem('split', String(value));
}
return (
<div
className='grid h-full'
style={{ gridTemplateColumns: `${split}% 9px 1fr` }}
>
<div className='min-w-0 overflow-auto'>{left}</div>
{/* A 9px grab area around a 1px line. */}
<div
role='separator'
aria-orientation='vertical'
aria-label='Resize panes'
aria-valuenow={Math.round(split)}
tabIndex={0}
className='group flex cursor-col-resize touch-none justify-center outline-none'
onPointerDown={(event) =>
event.currentTarget.setPointerCapture(event.pointerId)
}
onPointerMove={(event) => {
if (!event.currentTarget.hasPointerCapture(event.pointerId)) return;
const box =
event.currentTarget.parentElement!.getBoundingClientRect();
resize(((event.clientX - box.left) / box.width) * 100);
}}
onKeyDown={(event) => {
if (event.key === 'ArrowLeft') resize(split - STEP);
if (event.key === 'ArrowRight') resize(split + STEP);
}}
>
<div className='w-px bg-border group-hover:w-0.5 group-hover:bg-blue-500 group-focus-visible:w-0.5 group-focus-visible:bg-blue-500' />
</div>
<div className='min-w-0 overflow-auto'>{right}</div>
</div>
);
}Make the sign-in page a split screen: the form on the left half and a full-height brand image with a customer quote on the right; under 768px, hide the image and center the form. On the editor page, add a draggable divider between the code and preview panes, keep each pane at least 280px wide, support arrow keys on the focused divider, and save the split to localStorage.
Paste into Layerwise or any AI coding tool.
What is Split screen?
A split screen gives two things equal weight. On marketing and sign-in pages it is often a form or headline on one side and a large image or brand color on the other. In tools it is two working panes, such as a code editor and a live preview, or a chat and the app it is building, with a draggable divider between them.
On phones, stack the halves with the more important one first, or switch between them with tabs. For resizable panes, set a minimum width on each side, make the grab area wider than the visible line, use cursor: col-resize, let keyboard users move the divider with the arrow keys, and remember the size between visits.
A fixed split is a two-column grid: grid-template-columns: 1fr 1fr. For a resizable one, store the left pane’s width as a percentage and update it while the divider is dragged, or use a library such as react-resizable-panels.
Related terms
All termsSidebar
A vertical panel along the side of an app that holds the main navigation, often collapsible to a slim strip of icons.
Drag gesture
Moving an element by pressing on it and sliding the pointer or finger, usually within set bounds and with a glide after release.
Responsive design
Designing one layout that adapts to any screen width, rearranging columns, sizes, and navigation at set widths called breakpoints.
Hero section
The large first section at the top of a landing page, with a headline, a short subhead, a call to action, and a visual.
Build it with Layerwise
Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.
