LAYR
Layout Authoritative Yet Responsive: a compiled language for building websites deterministically, in your design's own numbers.
layr.dynshift.com @dynshift/layr on npm Source on GitHub
Why it exists
Building a page from a design is mostly translation. The design says 390
pixels wide, a 24-pixel gap, a 16-pixel radius; the code says rems,
viewport units, clamp() and media queries, plus a decision at
every breakpoint. By the end, the stylesheet no longer looks like the page,
and nobody can say exactly why the layout behaves as it does at 700 pixels.
LAYR makes the layout the program. A .layr file describes what
the page is, objects inside objects, so the code has the shape of the
result. Numbers are pixels of the design frame. A compiler checks the whole
thing before it runs and turns it into static CSS and React components.
What is in it
- The language. Pages, widgets, state and functions, with
logic kept to clearly marked places so the tree of objects stays readable.
One canonical form:
layr formatwrites every file the same way. - Design Scale. Design frames for phone, tablet, desktop and ultrawide; values scale with the screen inside a frame and are interpolated between frames, all compiled to plain CSS. No media queries to write.
- Deterministic layout. Fixed, hug and fill sizing, and a
documented order of adaptation when space runs out: shrink, then wrap or
stack, and clip only with a warning.
layr analyzeexplains any adaptation. - EIED. Export, Inject, Extract and Duplicate let any part
of an app read, change or copy any object, as ordered, reversible layers
the compiler checks. Objects are protected by default, and
!mutprotects what must never change. - Tooling. The
layrCLI, guided upgrades, a language server and a VS Code extension.
Built for agents as well as people
LAYR is designed to be written by AI coding agents as well as by people.
Where CSS offers many ways to write the same layout, LAYR has one canonical
form; layout follows fixed, documented rules instead of being found out in
a browser; and every problem is a coded diagnostic that
layr analyze --json reports in a form an agent can act on.
layr skills install adds the LAYR Skill, generated from the
compiler's own schema and matched to the installed version, and an MCP
server that can look up widgets, check a snippet and analyse the project.
How it fits with React
LAYR compiles to React, and works with it in both directions: React packages
can be used inside LAYR, even as JSX in the tree, and an existing React app
can import .layr files. React is the engine underneath, not the
way LAYR is written, so a project can adopt it one page at a time.
Who it is for
People who build websites from designs and want the design's numbers to be the code's numbers: designers who write their own front ends, developers who work closely with design files, and small teams who would rather read a layout than reverse-engineer one. Flutter developers will recognise the object tree and the hug-and-fill sizing.
LAYR 1.x
Until September 2026, @dynshift/layr was a small library of
Flutter-style layout components for React (Container,
Row, Column, Stack and the rest).
LAYR 3.0 replaced it as the default package on 25 September 2026. The 1.x
library stays installable as @dynshift/layr@v1, its source is
on the repository's v1 branch, and the documentation has a
guide for migrating.
Getting it
The playground runs LAYR in the browser with
nothing to install. For a project, install @dynshift/layr from
npm and run layr create. The LAYR site has
the documentation, the widget reference and the changelog; the source,
issues and pull requests are on GitHub.
Two articles go further:
Introducing LAYR and
How LAYR works.