diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,47 @@
+## 0.2.0
+
+Layout follows SwiftUI more closely. Where SwiftUI is silent, it picks the least surprising option.
+
+### Stacks
+
+`HStack` and `VStack` got `spacing` and `align`. `hstack` and `vstack` take both. `hstack_` and `vstack_` keep the old look.
+
+Stacks share space more fairly. They hold back room for the children still waiting, never offer a child less than its minimum, and give parent-sized children what the others leave. Their cross axis spans their widest child. Their size never goes negative or drifts from where the children end up.
+
+Negative spacing overlaps children, as in SwiftUI.
+
+### Spacers
+
+A spacer expands only along its stack's axis, as in SwiftUI. Outside a row or column it still fills both ways. A row with a spacer no longer swallows its column's height.
+
+### Clearance
+
+A view can ask to keep space from its stack neighbours on each edge, through the new `clearance` field of `ViewSize`. A stack puts the larger of its spacing and its children's requests between them. Neighbouring requests collapse instead of adding up. Containers pass on the requests of their outer children. Padding counts toward them.
+
+### Frames and aspect ratio
+
+`FlexibleFrame` follows SwiftUI's flexible frame. Its constraints moved to a new `FrameBounds` record, where a missing bound means "no constraint" rather than "take the parent's size". `between`, `widthWithin`, `heightWithin`, `fillWidth`, `fillHeight` and `filling` build bounds. A frame that fills now measures as flexible instead of parent-sized.
+
+`AspectRatio` letterboxes its content. It offers the child the largest box with its ratio that the child can grow into. It reports the smallest box with that ratio around the child's answer. A ratio without a positive, finite quotient does nothing.
+
+`Padding` adds its insets to both ends of its measured range.
+
+### Layers
+
+`Overlay` and `ZStack` got an `align` field. They place each layer at the size it reports, as in SwiftUI. The new `Background` works like `Overlay` but paints its secondary behind the primary.
+
+Traversal runs back to front, in paint order. Backgrounds come before their primary and overlays after it. `ZStack` layers keep their order. Painting in `foldMap` order is now correct.
+
+### Grid
+
+New `Grid` container, like SwiftUI's. Columns are as wide as their widest cell and rows as tall as their tallest. Cells that would stretch forever fill their slot without widening it. A column or row made only of them takes what is left.
+
+`span_` lets a cell span columns and rows, like an HTML table cell. Cells fill row by row around earlier spans. A spanning cell gets its room before open tracks take the rest. It grows the covered tracks that can still grow first.
+
+### Upgrading
+
+Code that builds `HStack`, `VStack`, `ZStack`, `Overlay` or `ViewSize` directly needs the new fields. `FlexibleFrame` takes `FrameBounds`. A `parent_` pin becomes `filling`. A `range_` frame becomes `between`, which takes the offered size instead of hugging its child.
+
 ## 0.1.1
 
 - Added `Geomancy.Layout.View` - an experimental SwiftUI-like propose-report-place protocol.
diff --git a/geomancy-layout.cabal b/geomancy-layout.cabal
--- a/geomancy-layout.cabal
+++ b/geomancy-layout.cabal
@@ -1,11 +1,11 @@
 cabal-version: 1.12
 
--- This file has been generated from package.yaml by hpack version 0.37.0.
+-- This file has been generated from package.yaml by hpack version 0.39.6.
 --
 -- see: https://github.com/sol/hpack
 
 name:           geomancy-layout
-version:        0.1.1
+version:        0.2.0
 synopsis:       Geometry and matrix manipulation
 description:    Layout primitives and algorithms for geomancy data.
 category:       Graphics
@@ -56,6 +56,13 @@
   main-is: Spec.hs
   other-modules:
       Examples
+      Menu.Grids
+      Menu.Harbour
+      Menu.Iron
+      Menu.Jungle
+      Menu.Kit
+      Menu.Probe
+      Menu.Svg
       Paths_geomancy_layout
   hs-source-dirs:
       test
@@ -73,6 +80,7 @@
   ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -with-rtsopts=-qn1 -with-rtsopts=-A128m
   build-depends:
       base >=4.7 && <5
+    , directory
     , geomancy >=0.2.6 && <1
     , geomancy-layout
     , lucid-svg
diff --git a/src/Geomancy/Layout/View.hs b/src/Geomancy/Layout/View.hs
--- a/src/Geomancy/Layout/View.hs
+++ b/src/Geomancy/Layout/View.hs
@@ -1,7 +1,7 @@
 {-# LANGUAGE AllowAmbiguousTypes #-}
 {-# LANGUAGE DefaultSignatures #-}
 
-{- | SwiftUI-like view tree
+{-| SwiftUI-like view tree
 
 The layout keeps the propose-report-place protocol, but chops some parts away.
 
@@ -15,18 +15,21 @@
 import Data.Bifunctor (Bifunctor(..))
 import Data.Foldable (toList)
 import Data.Foldable1 (foldMap1')
+import Data.Traversable (foldMapDefault)
 import Data.Functor.Identity (Identity)
 import Data.List (mapAccumL, foldl', sortOn)
 import Data.List.NonEmpty (nonEmpty)
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Maybe (fromMaybe)
 import Geomancy ((^*))
 import Geomancy.Gl.Funs (glClamp)
 import Geomancy.Layout qualified as Layout
-import Geomancy.Layout.Alignment (Alignment)
+import Geomancy.Layout.Alignment (Alignment(..))
 import Geomancy.Layout.Alignment qualified as Alignment
 import Geomancy.Layout.Box (Box(..))
 import Geomancy.Layout.Box qualified as Box
 import Geomancy.Vec2 (Vec2, vec2, withVec2, pattern WithVec2)
-import Geomancy.Vec4 (Vec4, withVec4)
+import Geomancy.Vec4 (Vec4, vec4, withVec4)
 import GHC.Arr (array)
 
 -- | Run all the layout steps to annotate the nodes with their final placement boxes.
@@ -73,23 +76,10 @@
   default proposeView :: (ReportedCache stuff ~ stuff) => Vec2 -> stuff -> (Vec2, ReportedCache stuff)
   proposeView = (,)
 
-  -- | Default implementation for "box function" placement
+-- | Default implementation for "box function" placement
   default placeView :: (ReportedCache stuff ~ (Box -> Placed stuff)) => Box -> ReportedCache stuff -> Placed stuff
   placeView placed f = f placed
 
--- | "Variant-lite" instance to mix widgets of different type
---
--- XXX: the foldable/traversable would skip the Lefts.
--- Use something like `foldWith` to pre-process and normalize to a common "backend" type
-instance (LayoutView l, LayoutView r) => LayoutView (Either l r) where
-  type ReportedCache (Either l r) = Either (ReportedCache l) (ReportedCache r)
-  type Placed (Either l r) = Either (Placed l) (Placed r)
-  viewFlexibility = either viewFlexibility viewFlexibility
-  proposeView proposed = either (fmap Left <$> proposeView proposed) (fmap Right <$> proposeView proposed)
-  placeView placed = \case
-    Left x -> Left $ placeView @l placed x
-    Right x -> Right $ placeView @r placed x
-
 {- | Do-nothing pass-through instance
 
 You'll have to peek at the @View{ann}@ of the placement tree.
@@ -114,10 +104,6 @@
 viewFun :: ViewSize -> (Vec2 -> (Vec2, Box -> stuff)) -> View () (ViewFun stuff)
 viewFun flex steps = View{ann=(), stuff=ViewFun flex steps}
 
--- | A wrapper to construct 'ViewFun'-based views by assuming infinite flex and no intrinsic size
-boxFun :: (Box -> stuff) -> View () (ViewFun stuff)
-boxFun f = viewFun infinite_ (,f)
-
 instance LayoutView (ViewFun stuff) where
   type ReportedCache (ViewFun stuff) = Box -> stuff -- ^ Propose to resolve the outer
   type Placed (ViewFun stuff) = stuff
@@ -144,24 +130,41 @@
   | HStack
       { ann :: ann
         -- TODO: placement direction
-        -- TODO: spacing to inject
+      , spacing :: Float
+      , align :: Alignment
       , children :: [View ann stuff]
       } -- ^ Place children side-by-side (LTR)
   | VStack
       { ann :: ann
         -- TODO: placement direction
-        -- TODO: spacing to inject
+      , spacing :: Float
+      , align :: Alignment
       , children :: [View ann stuff]
       } -- ^ Place children top-to-bottom
   | ZStack
       { ann :: ann
+      , align :: Alignment
       , children :: [View ann stuff]
       } -- ^ Place children atop of each other
+  | Grid
+      { ann :: ann
+      , columnSpacing :: Float
+      , rowSpacing :: Float
+      , align :: Alignment
+      , rows :: [[View ann stuff]]
+      }
   | Overlay
       { ann :: ann
+      , align :: Alignment
       , secondary :: View ann stuff
       , primary :: View ann stuff
       } -- ^ Propose the size of the primary view to the secondary view
+  | Background
+      { ann :: ann
+      , align :: Alignment
+      , secondary :: View ann stuff
+      , primary :: View ann stuff
+      }
 
   -- "modifiers"
   | Frame
@@ -172,7 +175,7 @@
       } -- ^ Propose/report size unconditionally
   | FlexibleFrame
       { ann :: ann
-      , flex :: ViewSize -- ^ Acceptable size ranges
+      , bounds :: FrameBounds -- ^ Acceptable size ranges
       , align :: Alignment
       , inner :: View ann stuff
       } -- ^ Adjust measurement flex and clamp proposed/reported size
@@ -193,20 +196,49 @@
       , xy :: Vec2
       , inner :: View ann stuff
       } -- ^ Adds offset when placing a view
-  deriving (Eq, Show, Functor, Foldable, Traversable)
+  | Span
+      { ann :: ann
+      , columnSpan :: Int
+      , rowSpan :: Int
+      , inner :: View ann stuff
+      }
+  deriving (Eq, Show, Functor)
 
+instance Foldable (View ann) where
+  foldMap = foldMapDefault
+
+instance Traversable (View ann) where
+  traverse f = \case
+    View{ann, stuff} -> (\stuff' -> View{ann, stuff = stuff'}) <$> f stuff
+    Spacer{ann} -> pure Spacer{ann}
+    HStack{..} -> (\children' -> HStack{children = children', ..}) <$> traverse (traverse f) children
+    VStack{..} -> (\children' -> VStack{children = children', ..}) <$> traverse (traverse f) children
+    ZStack{..} -> (\children' -> ZStack{children = children', ..}) <$> traverse (traverse f) children
+    Grid{..} -> (\rows' -> Grid{rows = rows', ..}) <$> traverse (traverse (traverse f)) rows
+    Background{..} -> (\secondary' primary' -> Background{secondary = secondary', primary = primary', ..}) <$> traverse f secondary <*> traverse f primary
+    Overlay{..} -> (\primary' secondary' -> Overlay{primary = primary', secondary = secondary', ..}) <$> traverse f primary <*> traverse f secondary
+    Frame{..} -> (\inner' -> Frame{inner = inner', ..}) <$> traverse f inner
+    FlexibleFrame{..} -> (\inner' -> FlexibleFrame{inner = inner', ..}) <$> traverse f inner
+    AspectRatio{..} -> (\inner' -> AspectRatio{inner = inner', ..}) <$> traverse f inner
+    Padding{..} -> (\inner' -> Padding{inner = inner', ..}) <$> traverse f inner
+    Offset{..} -> (\inner' -> Offset{inner = inner', ..}) <$> traverse f inner
+    Span{..} -> (\inner' -> Span{inner = inner', ..}) <$> traverse f inner
+
 instance Bifunctor View where
   first f = \case
     View{..} -> View{ann = f ann, stuff}
     Spacer{..} -> Spacer{ann = f ann}
-    HStack{ann, children} -> HStack{ann = f ann, children = map (first f) children}
-    VStack{ann, children} -> VStack{ann = f ann, children = map (first f) children}
-    ZStack{ann, children} -> ZStack{ann = f ann, children = map (first f) children}
-    Overlay{ann, primary, secondary} -> Overlay{ann = f ann, primary = first f primary, secondary = first f secondary}
+    HStack{..} -> HStack{ann = f ann, children = map (first f) children, ..}
+    VStack{..} -> VStack{ann = f ann, children = map (first f) children, ..}
+    ZStack{..} -> ZStack{ann = f ann, children = map (first f) children, ..}
+    Grid{..} -> Grid{ann = f ann, rows = map (map (first f)) rows, ..}
+    Overlay{..} -> Overlay{ann = f ann, primary = first f primary, secondary = first f secondary, ..}
+    Background{..} -> Background{ann = f ann, primary = first f primary, secondary = first f secondary, ..}
     Frame{..} -> Frame{ann = f ann, inner = first f inner, ..}
     FlexibleFrame{..} -> FlexibleFrame{ann = f ann, inner = first f inner, ..}
     Padding{..} -> Padding{ann = f ann, inner = first f inner, ..}
     Offset{..} -> Offset{ann = f ann, inner = first f inner, ..}
+    Span{..} -> Span{ann = f ann, inner = first f inner, ..}
     AspectRatio{..} -> AspectRatio{ann = f ann, inner = first f inner, ..}
   second = fmap
 
@@ -221,24 +253,48 @@
 -- *** Containers
 
 hstack_ :: [View () stuff] -> View () stuff
-hstack_ children = HStack{ann=(), ..}
+hstack_ = hstack 0 Alignment.leftMiddle
 
 vstack_ :: [View () stuff] -> View () stuff
-vstack_ children = VStack{ann=(), ..}
+vstack_ = vstack 0 Alignment.centerTop
 
+hstack :: Float -> Alignment -> [View () stuff] -> View () stuff
+hstack spacing align children = HStack{ann=(), ..}
+
+vstack :: Float -> Alignment -> [View () stuff] -> View () stuff
+vstack spacing align children = VStack{ann=(), ..}
+
 zstack_ :: [View () stuff] -> View () stuff
-zstack_ children = ZStack{ann=(), ..}
+zstack_ = zstack Alignment.center
 
+zstack :: Alignment -> [View () stuff] -> View () stuff
+zstack align children = ZStack{ann=(), ..}
+
+grid_ :: [[View () stuff]] -> View () stuff
+grid_ = grid 0 0 Alignment.center
+
+grid :: Float -> Float -> Alignment -> [[View () stuff]] -> View () stuff
+grid columnSpacing rowSpacing align rows = Grid{ann=(), ..}
+
 overlay_ :: View () stuff -> View () stuff -> View () stuff
-overlay_ secondary primary = Overlay{ann=(), ..}
+overlay_ = overlay Alignment.center
 
+overlay :: Alignment -> View () stuff -> View () stuff -> View () stuff
+overlay align secondary primary = Overlay{ann=(), ..}
+
+background_ :: View () stuff -> View () stuff -> View () stuff
+background_ = background Alignment.center
+
+background :: Alignment -> View () stuff -> View () stuff -> View () stuff
+background align secondary primary = Background{ann=(), ..}
+
 -- *** Modifiers
 
 frame_ :: Vec2 -> View () stuff -> View () stuff
 frame_ size inner = Frame{ann=(), align = Alignment.center, ..}
 
-flexible_ :: ViewSize -> Alignment -> View () stuff -> View () stuff
-flexible_ flex align inner = FlexibleFrame{ann=(), ..}
+flexible_ :: FrameBounds -> Alignment -> View () stuff -> View () stuff
+flexible_ bounds align inner = FlexibleFrame{ann=(), ..}
 
 aspect_ :: Vec2 -> View () stuff -> View () stuff
 aspect_ ratio inner = AspectRatio{ann=(), aspect=ratio, align=Alignment.center, ..}
@@ -249,6 +305,9 @@
 offset_ :: Vec2 -> View () stuff -> View () stuff
 offset_ xy inner = Offset{ann=(), ..}
 
+span_ :: Int -> Int -> View () stuff -> View () stuff
+span_ columnSpan rowSpan inner = Span{ann=(), ..}
+
 -- * Flexibility helper
 
 -- | Represents size constraints and flexibility for a layout node.
@@ -256,8 +315,24 @@
   { minWidth, maxWidth
   , minHeight, maxHeight :: Maybe Float
   -- XXX: put ideal size here?
+  , clearance :: !Box.TRBL
   } deriving (Eq, Show)
 
+noClearance :: Box.TRBL
+noClearance = Box.TRBL 0
+
+withClearance :: ViewSize -> Box.WithTRBL r -> r
+withClearance size = withEdges size.clearance
+
+withEdges :: Box.TRBL -> Box.WithTRBL r -> r
+withEdges (Box.TRBL trbl) = withVec4 trbl
+
+widerClearance :: Box.TRBL -> Box.TRBL -> Box.TRBL
+widerClearance (Box.TRBL a) (Box.TRBL b) =
+  withVec4 a \at ar ab al ->
+    withVec4 b \bt br bb bl ->
+      Box.TRBL $ vec4 (max at bt) (max ar br) (max ab bb) (max al bl)
+
 -- | Creates a ViewSize for a fixed-size view.
 fixed_ :: Vec2 -> ViewSize
 fixed_ size =
@@ -267,6 +342,7 @@
       , maxWidth = Just w
       , minHeight = Just h
       , maxHeight = Just h
+      , clearance = noClearance
       }
 
 -- | Creates a ViewSize for a fully flexible view.
@@ -276,6 +352,7 @@
   , maxWidth = Just inf
   , minHeight = Just 0
   , maxHeight = Just inf
+  , clearance = noClearance
   }
 
 range_ :: Vec2 -> Vec2 -> ViewSize
@@ -287,8 +364,18 @@
         , maxWidth = Just $ max aw bw
         , minHeight = Just $ min ah bh
         , maxHeight = Just $ max ah bh
+        , clearance = noClearance
         }
 
+data Axis = Horizontal | Vertical
+  deriving (Eq, Show)
+
+spacerSize :: Maybe Axis -> ViewSize
+spacerSize = \case
+  Nothing -> infinite_
+  Just Horizontal -> infinite_{minHeight = Just 0, maxHeight = Just 0}
+  Just Vertical -> infinite_{minWidth = Just 0, maxWidth = Just 0}
+
 -- | Creates a ViewSize that reports parent size
 parent_ :: ViewSize
 parent_ = ViewSize
@@ -296,6 +383,7 @@
   , maxWidth = Nothing
   , minHeight = Nothing
   , maxHeight = Nothing
+  , clearance = noClearance
   }
 
 parentWidth :: ViewSize -> ViewSize
@@ -304,74 +392,163 @@
 parentHeight :: ViewSize -> ViewSize
 parentHeight a = a {minHeight = Nothing, maxHeight = Nothing}
 
+data FrameBounds = FrameBounds
+  { frameMinWidth, frameMaxWidth
+  , frameMinHeight, frameMaxHeight :: Maybe Float
+  , frameClearance :: !Box.TRBL
+  } deriving (Eq, Show)
+
+unbounded :: FrameBounds
+unbounded = FrameBounds
+  { frameMinWidth = Nothing
+  , frameMaxWidth = Nothing
+  , frameMinHeight = Nothing
+  , frameMaxHeight = Nothing
+  , frameClearance = noClearance
+  }
+
+between :: Vec2 -> Vec2 -> FrameBounds
+between a b =
+  withVec2 a \aw ah ->
+    withVec2 b \bw bh ->
+      heightWithin ah bh $ widthWithin aw bw unbounded
+
+widthWithin :: Float -> Float -> FrameBounds -> FrameBounds
+widthWithin lo hi bounds = bounds{frameMinWidth = Just (min lo hi), frameMaxWidth = Just (max lo hi)}
+
+heightWithin :: Float -> Float -> FrameBounds -> FrameBounds
+heightWithin lo hi bounds = bounds{frameMinHeight = Just (min lo hi), frameMaxHeight = Just (max lo hi)}
+
+fillWidth :: FrameBounds -> FrameBounds
+fillWidth bounds = bounds{frameMaxWidth = Just inf}
+
+fillHeight :: FrameBounds -> FrameBounds
+fillHeight bounds = bounds{frameMaxHeight = Just inf}
+
+filling :: FrameBounds
+filling = fillHeight $ fillWidth unbounded
+
 -- * Layout steps
 
 -- | Measurement pre-pass
 measure :: LayoutView stuff => View () stuff -> View ViewSize stuff
-measure = \case
+measure = measureAlong Nothing
+
+measureAlong :: LayoutView stuff => Maybe Axis -> View () stuff -> View ViewSize stuff
+measureAlong stackAxis = \case
   View {stuff} -> View{ann=viewFlexibility stuff, stuff}
-  Spacer{} -> Spacer{ann=infinite_}
-  Frame{..} -> Frame{ann=fixed_ size, inner=measure inner, ..}
-  FlexibleFrame{..} -> FlexibleFrame{ann=flex', inner=inner', ..}
+  Spacer{} -> Spacer{ann=spacerSize stackAxis}
+  Frame{..} -> Frame{ann=(fixed_ size){clearance = inner'.ann.clearance}, inner=inner', ..}
     where
-      inner' = measure inner
+      inner' = measureAlong stackAxis inner
+  FlexibleFrame{..} -> FlexibleFrame{ann=bounded, inner=inner', ..}
+    where
+      inner' = measureAlong stackAxis inner
       innerFlex = inner'.ann
-      flex' = ViewSize -- intersection of flexibility ranges
-        { minWidth = max <$> flex.minWidth <*> innerFlex.minWidth
-        , maxWidth = min <$> flex.maxWidth <*> innerFlex.maxWidth
-        , minHeight = max <$> flex.minHeight <*> innerFlex.minHeight
-        , maxHeight = min <$> flex.maxHeight <*> innerFlex.maxHeight
+      bounded = ViewSize
+        { minWidth = frameLeast ordered.frameMinWidth ordered.frameMaxWidth innerFlex.minWidth
+        , maxWidth = frameMost ordered.frameMinWidth ordered.frameMaxWidth innerFlex.maxWidth
+        , minHeight = frameLeast ordered.frameMinHeight ordered.frameMaxHeight innerFlex.minHeight
+        , maxHeight = frameMost ordered.frameMinHeight ordered.frameMaxHeight innerFlex.maxHeight
+        , clearance = widerClearance bounds.frameClearance innerFlex.clearance
         }
+      ordered = orderedBounds bounds
   Padding{..} -> Padding{ann=expanded, inner=inner', ..}
     where
-      inner' = measure inner
+      inner' = measureAlong stackAxis inner
       innerFlex = inner'.ann
       expanded = withVec4 trbl4 \t r b l -> innerFlex
         { minWidth = (+ (l + r)) <$> innerFlex.minWidth
+        , maxWidth = (+ (l + r)) <$> innerFlex.maxWidth
         , minHeight = (+ (t + b)) <$> innerFlex.minHeight
+        , maxHeight = (+ (t + b)) <$> innerFlex.maxHeight
+        , clearance = withClearance innerFlex \ct cr cb cl ->
+            Box.TRBL $ vec4 (unpadded t ct) (unpadded r cr) (unpadded b cb) (unpadded l cl)
         }
+      unpadded pad clear
+        | clear > 0 = max 0 (clear - pad)
+        | otherwise = 0
       Box.TRBL trbl4 = trbl
   Offset{..} -> Offset{ann=inner'.ann, inner=inner', ..}
     where
-      inner' = measure inner
+      inner' = measureAlong stackAxis inner
+  Span{..} -> Span{ann=inner'.ann, inner=inner', ..}
+    where
+      inner' = measureAlong stackAxis inner
   AspectRatio{..} -> AspectRatio{ann=ann', inner=inner', ..}
     where
-      ann' = inner'.ann -- XXX: pass-through?
-      inner' = measure inner
-  HStack{children} -> HStack{ann=stackViewSize, children=measured}
+      ann' = maybe inner'.ann (`aspectRange` inner'.ann) (usableAspect aspect)
+      inner' = measureAlong stackAxis inner
+  HStack{spacing, align, children} -> HStack{ann=gaps stackViewSize, children=measured, spacing, align}
     where
-      measured = map measure children
-      stackViewSize = foldl' (\vs -> stackViewSize' vs . ann) (fixed_ 0) measured
-      stackViewSize' a b = ViewSize
+      measured = map (measureAlong $ Just Horizontal) children
+      sizes = map ann measured
+      stackViewSize = foldl' stackViewSize' (fixed_ 0) sizes
+      stackViewSize' a b = a
         { minWidth = (+) <$> a.minWidth <*> b.minWidth -- combined horizontal flex
         , maxWidth = (+) <$> a.maxWidth <*> b.maxWidth
-        , minHeight = max <$> a.minHeight <*> b.minHeight -- intersection of vertical flex
-        , maxHeight = min <$> a.maxHeight <*> b.maxHeight
+        , minHeight = max <$> a.minHeight <*> b.minHeight -- union of vertical flex
+        , maxHeight = max <$> a.maxHeight <*> b.maxHeight
         }
-  VStack{children} -> VStack{ann=stackViewSize, children=measured}
+      totalGaps = sum $ rowGaps spacing sizes
+      gaps vs = vs
+        { minWidth = max 0 . (+ totalGaps) <$> vs.minWidth
+        , maxWidth = max 0 . (+ totalGaps) <$> vs.maxWidth
+        , clearance = rowClearance sizes
+        }
+  VStack{spacing, align, children} -> VStack{ann=gaps stackViewSize, children=measured, spacing, align}
     where
-      measured = map measure children
-      stackViewSize = foldl' (\vs -> stackViewSize' vs . ann) (fixed_ 0) measured
-      stackViewSize' a b = ViewSize
-        { minWidth = max <$> a.minWidth <*> b.minWidth -- intersection of horizontal flex
-        , maxWidth = min <$> a.maxWidth <*> b.maxWidth
+      measured = map (measureAlong $ Just Vertical) children
+      sizes = map ann measured
+      stackViewSize = foldl' stackViewSize' (fixed_ 0) sizes
+      stackViewSize' a b = a
+        { minWidth = max <$> a.minWidth <*> b.minWidth -- union of horizontal flex
+        , maxWidth = max <$> a.maxWidth <*> b.maxWidth
         , minHeight = (+) <$> a.minHeight <*> b.minHeight --  combined vertical flex
         , maxHeight = (+) <$> a.maxHeight <*> b.maxHeight
         }
-  ZStack{children} -> ZStack{ann=stackViewSize, children=measured}
+      totalGaps = sum $ columnGaps spacing sizes
+      gaps vs = vs
+        { minHeight = max 0 . (+ totalGaps) <$> vs.minHeight
+        , maxHeight = max 0 . (+ totalGaps) <$> vs.maxHeight
+        , clearance = columnClearance sizes
+        }
+  ZStack{align, children} -> ZStack{ann=stackViewSize, align, children=measured}
     where
-      measured = map measure children
+      measured = map (measureAlong Nothing) children
       stackViewSize = foldl' (\vs -> stackViewSize' vs . ann) (fixed_ 0) measured
       stackViewSize' a b = ViewSize
-        { minWidth = max <$> a.minWidth <*> b.minWidth -- intersection of horizontal flex
-        , maxWidth = min <$> a.maxWidth <*> b.maxWidth
-        , minHeight = max <$> a.minHeight <*> b.minHeight --  intersection of vertical flex
-        , maxHeight = min <$> a.maxHeight <*> b.maxHeight
+        { minWidth = max <$> a.minWidth <*> b.minWidth -- union of horizontal flex
+        , maxWidth = max <$> a.maxWidth <*> b.maxWidth
+        , minHeight = max <$> a.minHeight <*> b.minHeight --  union of vertical flex
+        , maxHeight = max <$> a.maxHeight <*> b.maxHeight
+        , clearance = widerClearance a.clearance b.clearance
         }
-  Overlay{primary, secondary} -> Overlay{ann=primary'.ann, primary=primary', secondary=secondary'}
+  Grid{columnSpacing, rowSpacing, align, rows} -> Grid{ann=gridSize, columnSpacing, rowSpacing, align, rows=measured}
     where
-      primary' = measure primary -- pass-through wrt primary measurements
-      secondary' = measure secondary -- ignore secondary flex
+      measured = map (map (measureAlong Nothing)) rows
+      spotted = zip (concat $ gridSpots measured) (concatMap (map ann) measured)
+      columnCount = gridColumnCount (map fst spotted)
+      rowCount = length rows
+      columnGapsAt = spanGaps columnSpacing columnCount [(alongColumns spot, (leftEdge size.clearance, rightEdge size.clearance)) | (spot, size) <- spotted]
+      rowGapsAt = spanGaps rowSpacing rowCount [(alongRows spot, (topEdge size.clearance, bottomEdge size.clearance)) | (spot, size) <- spotted]
+      widths = axisRanges columnCount columnGapsAt [(alongColumns spot, widthRange size) | (spot, size) <- spotted]
+      heights = axisRanges rowCount rowGapsAt [(alongRows spot, heightRange size) | (spot, size) <- spotted]
+      gridSize = ViewSize
+        { minWidth = Just $ max 0 (sum (map fst widths) + sum columnGapsAt)
+        , maxWidth = Just $ max 0 (sum (map snd widths) + sum columnGapsAt)
+        , minHeight = Just $ max 0 (sum (map fst heights) + sum rowGapsAt)
+        , maxHeight = Just $ max 0 (sum (map snd heights) + sum rowGapsAt)
+        , clearance = spanClearance rowCount columnCount [(spot, size.clearance) | (spot, size) <- spotted]
+        }
+  Overlay{align, primary, secondary} -> Overlay{ann=primary'.ann, align, primary=primary', secondary=secondary'}
+    where
+      primary' = measureAlong stackAxis primary -- pass-through wrt primary measurements
+      secondary' = measureAlong Nothing secondary -- ignore secondary flex
+  Background{align, primary, secondary} -> Background{ann=primary'.ann, align, primary=primary', secondary=secondary'}
+    where
+      primary' = measureAlong stackAxis primary
+      secondary' = measureAlong Nothing secondary
 
 -- | Run the propose-report-place protocol on a flex-measured view tree
 place :: LayoutView stuff => Box -> View ViewSize stuff -> View Box (Placed stuff)
@@ -387,8 +564,8 @@
   -> View ViewSize stuff
   -> (Vec2, Box -> View Box (Placed stuff))
 suspend proposed = \case
-  Spacer{} ->
-    ( proposed -- report the proposed
+  Spacer{ann} ->
+    ( vsClamp proposed ann proposed
     , \placed -> Spacer{ann=placed} -- keep the placed
     )
   View{stuff} ->
@@ -419,7 +596,7 @@
     where
       (reported, suspended) = suspend size inner -- frame proposes its size
   FlexibleFrame{..} ->
-    ( vsClamp proposed flex reported -- reports clamped to self, while defaulting to parent
+    ( framedSize bounds proposed reported
     , \placed ->
         let
           innerBox = Layout.placeSize align reported placed
@@ -431,8 +608,7 @@
             }
     )
     where
-      -- proposes clamped parent
-      (reported, suspended) = suspend (vsClamp proposed flex proposed) inner
+      (reported, suspended) = suspend (offeredSize bounds proposed) inner
   Padding{..} ->
     ( reported + pads
     , \placed ->
@@ -459,8 +635,14 @@
     )
     where
       (reported, suspended) = suspend proposed inner
-  AspectRatio{..} ->
+  Span{..} ->
     ( reported
+    , \placed -> Span{ann = placed, inner = suspended placed, ..}
+    )
+    where
+      (reported, suspended) = suspend proposed inner
+  AspectRatio{..} ->
+    ( maybe reported (`coverAspect` reported) ratio
     , \placed ->
         let
           innerBox = Layout.placeSize align reported placed
@@ -472,49 +654,50 @@
           }
     )
     where
-      -- 1. query direct size, ignore suspended
-      probed = fst $ suspend (aspect ^* scale proposed) inner
-      -- 2. re-query with the fit size
-      (reported, suspended) = suspend (aspect ^* scale probed) inner
-      scale p =
-        withVec2 aspect \aw ah ->
-          withVec2 p \pw ph ->
-            if pw / ph > aw / ah then
-              ph / ah
-            else
-              pw / aw
-  HStack{children} ->
+      ratio = usableAspect aspect
+      (reported, suspended) = suspend (maybe proposed (\r -> fitAspect r $ growableRoom inner.ann proposed) ratio) inner
+  HStack{spacing, align, children} ->
     -- Like the Frame, but operating on multiple elements
-    ( foldl' combineH 0 $ map fst children' -- stack reports the combined size of its children reports
+    ( vec2 runWidth crossHeight -- stack reports the combined size of its children reports
     , \placedStack ->
         let
           placedChildren :: [View Box (Placed stuff)]
-          placedChildren = snd $ mapAccumL placeLeftToRight placedStack children'
-            where
-              placeLeftToRight :: Box -> (Vec2, Box -> View Box (Placed stuff)) -> (Box, View Box (Placed stuff))
-              placeLeftToRight remaining (reportedSize, suspended) =
-                ( remaining'
-                , suspended placed
-                )
-                where
-                  (slot, remaining') = withVec2 reportedSize \w _h -> Layout.cutLeft w remaining
-                  placed = Layout.placeSize Alignment.center reportedSize slot
+          placedChildren =
+            Box.withTRBL (justify placedStack) \t _r b l ->
+              [ suspended $ Layout.placeSize align reportedSize (Box.fromTRBL t (l + start + w) b (l + start))
+              | ((reportedSize, suspended), start) <- zip children' starts
+              , let w = withVec2 reportedSize \w' _h -> w'
+              ]
+
+          justify box =
+            withVec2 alignOrigins \origin _ ->
+              shiftRun Layout.cutLeft origin (Box.width box - runWidth) box
         in
           HStack
             { ann = maybe placedStack (foldMap1' ann) $ nonEmpty placedChildren
             , children = placedChildren
+            , spacing
+            , align
             }
     )
     where
+      Alignment alignOrigins = align
+      slotGaps = rowGaps spacing $ map ann children
+      gaps = sum slotGaps
+      (starts, runWidth) = runOffsets slotGaps [withVec2 reportedSize \w _h -> w | (reportedSize, _) <- children']
+      crossHeight = foldl' max 0 [withVec2 reportedSize \_w h -> h | (reportedSize, _) <- children']
+
       -- | Record index, sort by flexibility, process, restore order
       children' =
         toList . array (0, numChildren - 1) $
-          snd $ mapAccumL f (fromIntegral numChildren, proposed) $
-            sortOn (widthFlexibility . ann . snd) $ zip [0 :: Int ..] children
+          snd $ mapAccumL f (fromIntegral numChildren, budget) $ zip (reservedAfter minWidthOf sorted) sorted
+      sorted = sortOn (widthFlexibility . ann . snd) $ zip [0 :: Int ..] children
+      minWidthOf = fromMaybe 0 . (.minWidth) . ann
       numChildren = length children
+      budget = withVec2 proposed \w h -> vec2 (max 0 $ w - gaps) h
 
-      f (childrenRemaining, WithVec2 remW remH) (ix, child) =
-        ( (childrenRemaining - 1.0, vec2 (remW - reportedWidth) remH)
+      f (childrenRemaining, WithVec2 remW remH) (reserved, (ix, child)) =
+        ( (childrenRemaining - 1.0, vec2 (max 0 $ remW - reportedWidth) remH)
         , ( ix
           , child'
           ) -- XXX: can use combineH here
@@ -522,39 +705,49 @@
         where
           WithVec2 reportedWidth _ = fst child'
           child' = suspend (vec2 proposeWidth remH) child
-          proposeWidth = remW / childrenRemaining
-  VStack{children} ->
+          proposeWidth = fairShare (minWidthOf child) reserved remW childrenRemaining
+  VStack{spacing, align, children} ->
     -- Like the HStack, but advancing vertically
-    ( foldl' combineV 0 $ map fst children'
+    ( vec2 crossWidth runHeight
     , \placedStack ->
         let
           placedChildren :: [View Box (Placed stuff)]
-          placedChildren = snd $ mapAccumL placeTopToBottom placedStack children'
-            where
-              placeTopToBottom :: Box -> (Vec2, Box -> View Box (Placed stuff)) -> (Box, View Box (Placed stuff))
-              placeTopToBottom remaining (reportedSize, suspended) =
-                ( remaining'
-                , suspended placed
-                )
-                where
-                  (slot, remaining') = withVec2 reportedSize \_w h -> Layout.cutTop h remaining
-                  placed = Layout.placeSize Alignment.center reportedSize slot
+          placedChildren =
+            Box.withTRBL (justify placedStack) \t r _b l ->
+              [ suspended $ Layout.placeSize align reportedSize (Box.fromTRBL (t + start) r (t + start + h) l)
+              | ((reportedSize, suspended), start) <- zip children' starts
+              , let h = withVec2 reportedSize \_w h' -> h'
+              ]
+
+          justify box =
+            withVec2 alignOrigins \_ origin ->
+              shiftRun Layout.cutTop origin (Box.height box - runHeight) box
         in
           VStack
             { ann = maybe placedStack (foldMap1' ann) $ nonEmpty placedChildren
             , children = placedChildren
+            , spacing
+            , align
             }
     )
     where
+      Alignment alignOrigins = align
+      slotGaps = columnGaps spacing $ map ann children
+      gaps = sum slotGaps
+      (starts, runHeight) = runOffsets slotGaps [withVec2 reportedSize \_w h -> h | (reportedSize, _) <- children']
+      crossWidth = foldl' max 0 [withVec2 reportedSize \w _h -> w | (reportedSize, _) <- children']
+
       -- | Record index, sort by flexibility, process, restore order
       children' =
         toList . array (0, numChildren - 1) $
-          snd $ mapAccumL f (fromIntegral numChildren, proposed) $
-            sortOn (heightFlexibility . ann . snd) $ zip [0 :: Int ..] children
+          snd $ mapAccumL f (fromIntegral numChildren, budget) $ zip (reservedAfter minHeightOf sorted) sorted
+      sorted = sortOn (heightFlexibility . ann . snd) $ zip [0 :: Int ..] children
+      minHeightOf = fromMaybe 0 . (.minHeight) . ann
       numChildren = length children
+      budget = withVec2 proposed \w h -> vec2 w (max 0 $ h - gaps)
 
-      f (childrenRemaining, WithVec2 remW remH) (ix, child) =
-        ( (childrenRemaining - 1.0, vec2 remW (remH - reportedHeight))
+      f (childrenRemaining, WithVec2 remW remH) (reserved, (ix, child)) =
+        ( (childrenRemaining - 1.0, vec2 remW (max 0 $ remH - reportedHeight))
         , ( ix
           , child'
           ) -- XXX: can use combineH here
@@ -562,46 +755,497 @@
         where
           WithVec2 _ reportedHeight = fst child'
           child' = suspend (vec2 remW proposeHeight) child
-          proposeHeight = remH / childrenRemaining
-  ZStack{children} ->
+          proposeHeight = fairShare (minHeightOf child) reserved remH childrenRemaining
+  ZStack{align, children} ->
     ( foldl' max2 0 reporteds
     , \placedStack ->
         let
-          placedChildren = map ($ placedStack) suspendeds
+          placedChildren =
+            [ suspended $ Layout.placeSize align reported placedStack
+            | (reported, suspended) <- zip reporteds suspendeds
+            ]
         in
           ZStack
             { ann = maybe placedStack (foldMap1' ann) $ nonEmpty placedChildren
+            , align
             , children = placedChildren
             }
     )
     where
       (reporteds, suspendeds) = unzip $ map (suspend proposed) children
-  Overlay{primary, secondary} ->
-    ( reportedPri
-    , \placed ->
+  Grid{columnSpacing, rowSpacing, align, rows} ->
+    ( vec2 runWidth runHeight
+    , \placedGrid ->
         let
-          placedPrimary = suspendedPri placed
+          justified =
+            withVec2 alignOrigins \originX originY ->
+              shiftRun Layout.cutTop originY (Box.height placedGrid - runHeight) $
+                shiftRun Layout.cutLeft originX (Box.width placedGrid - runWidth) placedGrid
+          placedRows =
+            Box.withTRBL justified \t _r _b l ->
+              [ [ placeCell $ Layout.placeSize align reported (slot t l spot)
+                | (spot, (reported, placeCell)) <- zip spotsInRow offeredInRow
+                ]
+              | (spotsInRow, offeredInRow) <- zip spots offered
+              ]
+          slot t l spot =
+            Box.fromTRBL top (left + spanWidth spot) (top + spanHeight spot) left
+            where
+              top = t + rowStarts !! spot.spotRow
+              left = l + columnStarts !! spot.spotColumn
         in
-          Overlay
-            { ann = placed
-            , primary = placedPrimary
-            , secondary = suspendedSec placedPrimary.ann -- inspect primary box
+          Grid
+            { ann = maybe placedGrid (foldMap1' ann) $ nonEmpty (concat placedRows)
+            , columnSpacing
+            , rowSpacing
+            , align
+            , rows = placedRows
             }
     )
     where
-      (reportedPri, suspendedPri) = suspend proposed primary
-      (_reportedSec, suspendedSec) = suspend reportedPri secondary -- inspect primary size
+      Alignment alignOrigins = align
+      WithVec2 offeredWidth offeredHeight = proposed
+      spots = gridSpots rows
+      spotted = zip (concat spots) (concat rows)
+      columnCount = gridColumnCount (map fst spotted)
+      rowCount = length rows
+      columnGapsAt = spanGaps columnSpacing columnCount [(alongColumns spot, (leftEdge cell.ann.clearance, rightEdge cell.ann.clearance)) | (spot, cell) <- spotted]
+      rowGapsAt = spanGaps rowSpacing rowCount [(alongRows spot, (topEdge cell.ann.clearance, bottomEdge cell.ann.clearance)) | (spot, cell) <- spotted]
+      columnWidths =
+        settleAxis offeredWidth columnGapsAt
+          (axisRanges columnCount columnGapsAt [(alongColumns spot, widthRange cell.ann) | (spot, cell) <- spotted])
+          [ (alongColumns spot, widthRange cell.ann, \offer -> withVec2 (fst $ suspend (vec2 offer offeredHeight) cell) \w _h -> w)
+          | (spot, cell) <- spotted
+          ]
+      spanWidth spot = spanLength columnWidths columnGapsAt (alongColumns spot)
+      rowHeights =
+        settleAxis offeredHeight rowGapsAt
+          (axisRanges rowCount rowGapsAt [(alongRows spot, heightRange cell.ann) | (spot, cell) <- spotted])
+          [ (alongRows spot, heightRange cell.ann, \offer -> withVec2 (fst $ suspend (vec2 (spanWidth spot) offer) cell) \_w h -> h)
+          | (spot, cell) <- spotted
+          ]
+      spanHeight spot = spanLength rowHeights rowGapsAt (alongRows spot)
+      offered =
+        [ [suspend (vec2 (spanWidth spot) (spanHeight spot)) cell | (spot, cell) <- zip spotsInRow row]
+        | (spotsInRow, row) <- zip spots rows
+        ]
+      (columnStarts, runWidth) = runOffsets columnGapsAt columnWidths
+      (rowStarts, runHeight) = runOffsets rowGapsAt rowHeights
+  Overlay{align, primary, secondary} ->
+    decorated proposed align primary secondary \placed primary' secondary' ->
+      Overlay{ann = placed, align, primary = primary', secondary = secondary'}
+  Background{align, primary, secondary} ->
+    decorated proposed align primary secondary \placed primary' secondary' ->
+      Background{ann = placed, align, primary = primary', secondary = secondary'}
 
+decorated
+  :: LayoutView stuff
+  => Vec2
+  -> Alignment
+  -> View ViewSize stuff
+  -> View ViewSize stuff
+  -> (Box -> View Box (Placed stuff) -> View Box (Placed stuff) -> View Box (Placed stuff))
+  -> (Vec2, Box -> View Box (Placed stuff))
+decorated proposed align primary secondary rebuild =
+  ( reportedPrimary
+  , \placed ->
+      let
+        placedPrimary = placePrimary placed
+      in
+        rebuild placed placedPrimary $ placeSecondary (Layout.placeSize align reportedSecondary placedPrimary.ann)
+  )
+  where
+    (reportedPrimary, placePrimary) = suspend proposed primary
+    (reportedSecondary, placeSecondary) = suspend reportedPrimary secondary
+
 -- * Internals
 
 inf :: Float
 inf = 1 / 0
 
+rowGaps :: Float -> [ViewSize] -> [Float]
+rowGaps spacing sizes =
+  zipWith gap sizes (drop 1 sizes)
+  where
+    gap before after =
+      withClearance before \_t right _b _l ->
+        withClearance after \_t' _r' _b' left ->
+          widestGap spacing [right, left]
+
+columnGaps :: Float -> [ViewSize] -> [Float]
+columnGaps spacing sizes =
+  zipWith gap sizes (drop 1 sizes)
+  where
+    gap before after =
+      withClearance before \_t _r bottom _l ->
+        withClearance after \top _r' _b' _l' ->
+          widestGap spacing [bottom, top]
+
+usableAspect :: Vec2 -> Maybe Vec2
+usableAspect aspect =
+  withVec2 aspect \aw ah ->
+    let
+      quotient = aw / ah
+    in
+      if quotient > 0 && not (isInfinite quotient) then
+        Just $ vec2 (abs aw) (abs ah)
+      else
+        Nothing
+
+fitAspect :: Vec2 -> Vec2 -> Vec2
+fitAspect aspect room =
+  withVec2 aspect \aw ah ->
+    withVec2 room \rw rh ->
+      aspect ^* min (rw / aw) (rh / ah)
+
+coverAspect :: Vec2 -> Vec2 -> Vec2
+coverAspect aspect content =
+  withVec2 aspect \aw ah ->
+    withVec2 content \cw ch ->
+      aspect ^* max (cw / aw) (ch / ah)
+
+growableRoom :: ViewSize -> Vec2 -> Vec2
+growableRoom ViewSize{..} proposed =
+  withVec2 proposed \pw ph ->
+    vec2 (capGrowth minWidth maxWidth pw) (capGrowth minHeight maxHeight ph)
+  where
+    capGrowth (Just lo) (Just hi) p | lo < hi = min p hi
+    capGrowth _ _ p = p
+
+aspectRange :: Vec2 -> ViewSize -> ViewSize
+aspectRange aspect content@ViewSize{..} =
+  withVec2 (coverAspect aspect $ vec2 (fromMaybe 0 minWidth) (fromMaybe 0 minHeight)) \loW loH ->
+    withVec2 (coverAspect aspect largest) \hiW hiH ->
+      content
+        { minWidth = Just loW
+        , maxWidth = Just hiW
+        , minHeight = Just loH
+        , maxHeight = Just hiH
+        }
+  where
+    room = fitAspect aspect $ growableRoom content (vec2 inf inf)
+    largest =
+      withVec2 room \rw rh ->
+        vec2 (answer minWidth maxWidth rw) (answer minHeight maxHeight rh)
+    answer lo hi r =
+      case (lo, hi) of
+        (Just l, Just h) | l < h -> min r h
+        (Just l, Just _) -> l
+        _ -> r
+
+widestGap :: Float -> [Float] -> Float
+widestGap spacing clearances = foldl' max spacing (filter (> 0) clearances)
+
+rowClearance :: [ViewSize] -> Box.TRBL
+rowClearance sizes =
+  case nonEmpty sizes of
+    Nothing ->
+      noClearance
+    Just ends ->
+      withClearance (NonEmpty.head ends) \_t _r _b left ->
+        withClearance (NonEmpty.last ends) \_t' right _b' _l' ->
+          withEdges (crossClearance sizes) \top _r'' bottom _l'' ->
+            Box.TRBL $ vec4 top right bottom left
+
+columnClearance :: [ViewSize] -> Box.TRBL
+columnClearance sizes =
+  case nonEmpty sizes of
+    Nothing ->
+      noClearance
+    Just ends ->
+      withClearance (NonEmpty.head ends) \top _r _b _l ->
+        withClearance (NonEmpty.last ends) \_t' _r' bottom _l' ->
+          withEdges (crossClearance sizes) \_t'' right _b'' left ->
+            Box.TRBL $ vec4 top right bottom left
+
+crossClearance :: [ViewSize] -> Box.TRBL
+crossClearance = foldl' widerClearance noClearance . map (.clearance)
+
+widthRange :: ViewSize -> (Maybe Float, Maybe Float)
+widthRange size = (size.minWidth, size.maxWidth)
+
+heightRange :: ViewSize -> (Maybe Float, Maybe Float)
+heightRange size = (size.minHeight, size.maxHeight)
+
+sizedRange :: (Maybe Float, Maybe Float) -> Bool
+sizedRange = \case
+  (_, Just most) -> not (isInfinite most)
+  _ -> False
+
+trackRange :: [(Maybe Float, Maybe Float)] -> (Float, Float)
+trackRange cells =
+  ( least
+  , case [most | (_, Just most) <- cells, not (isInfinite most)] of
+      [] -> inf
+      sized -> max least (maximum sized)
+  )
+  where
+    least = foldl' max 0 [fromMaybe 0 lo | (lo, _) <- cells]
+
+trackAnswer :: [((Maybe Float, Maybe Float), Float)] -> Float
+trackAnswer cells =
+  foldl' max 0 $ map known counted
+  where
+    counted =
+      case filter (sizedRange . fst) cells of
+        [] -> cells
+        sized -> sized
+    known (range, probed) =
+      case range of
+        (Just lo, Just hi) | lo == hi -> lo
+        _ -> probed
+
+settleTracks :: Float -> (track -> (Float, Float)) -> (track -> Float -> Float) -> [track] -> [Float]
+settleTracks budget rangeOf answer tracks =
+  toList . array (0, length tracks - 1) . snd $
+    mapAccumL settle (fromIntegral $ length tracks, budget) (zip (reservedAfter (fst . rangeOf) sorted) sorted)
+  where
+    sorted = sortOn (flexibility . rangeOf . snd) $ zip [0 :: Int ..] tracks
+    flexibility (lo, hi) = hi - lo
+    settle (remaining, room) (reserved, (ix, track)) =
+      ((remaining - 1, max 0 $ room - size), (ix, size))
+      where
+        least = fst (rangeOf track)
+        size = max least $ answer track (fairShare least reserved room remaining)
+
+data Spot = Spot
+  { spotRow, spotColumn, spotRows, spotColumns :: Int
+  }
+  deriving (Eq, Show)
+
+alongColumns :: Spot -> (Int, Int)
+alongColumns spot = (spot.spotColumn, spot.spotColumns)
+
+alongRows :: Spot -> (Int, Int)
+alongRows spot = (spot.spotRow, spot.spotRows)
+
+cellSpan :: View ann stuff -> (Int, Int)
+cellSpan = \case
+  Span{columnSpan, rowSpan} -> (max 1 columnSpan, max 1 rowSpan)
+  Frame{inner} -> cellSpan inner
+  FlexibleFrame{inner} -> cellSpan inner
+  AspectRatio{inner} -> cellSpan inner
+  Padding{inner} -> cellSpan inner
+  Offset{inner} -> cellSpan inner
+  Overlay{primary} -> cellSpan primary
+  Background{primary} -> cellSpan primary
+  _ -> (1, 1)
+
+gridSpots :: [[View ann stuff]] -> [[Spot]]
+gridSpots rows =
+  snd . mapAccumL placeRow [] $ zip [0 ..] (map (map cellSpan) rows)
+  where
+    rowCount = length rows
+    placeRow taken (row, spans) =
+      let
+        ((taken', _), spots) = mapAccumL (placeCell row) (taken, 0) spans
+      in
+        (taken', spots)
+    placeCell row (taken, cursor) (columnsWanted, rowsWanted) =
+      ((taken <> covered, column + columns), Spot{spotRow = row, spotColumn = column, spotRows = rows', spotColumns = columns})
+      where
+        free r c = (r, c) `notElem` taken
+        column = until (free row) (+ 1) cursor
+        columns = length $ takeWhile (free row) [column .. column + columnsWanted - 1]
+        rows' = length $ takeWhile (\r -> all (free r) [column .. column + columns - 1]) [row .. min (rowCount - 1) (row + rowsWanted - 1)]
+        covered = [(r, c) | r <- [row .. row + rows' - 1], c <- [column .. column + columns - 1]]
+
+gridColumnCount :: [Spot] -> Int
+gridColumnCount spots = foldl' max 0 [spot.spotColumn + spot.spotColumns | spot <- spots]
+
+innerGaps :: [Float] -> Int -> Int -> Float
+innerGaps gaps lead count = sum . take (count - 1) $ drop lead gaps
+
+spanLength :: [Float] -> [Float] -> (Int, Int) -> Float
+spanLength lengths gaps (lead, count) = sum (take count $ drop lead lengths) + innerGaps gaps lead count
+
+spanGaps :: Float -> Int -> [((Int, Int), (Float, Float))] -> [Float]
+spanGaps spacing count cells =
+  [ widestGap spacing $
+      [trailing | ((lead, n), (_leading, trailing)) <- cells, lead + n - 1 == boundary]
+        <> [leading | ((lead, _n), (leading, _trailing)) <- cells, lead == boundary + 1]
+  | boundary <- [0 .. count - 2]
+  ]
+
+spanClearance :: Int -> Int -> [(Spot, Box.TRBL)] -> Box.TRBL
+spanClearance rowCount columnCount cells =
+  Box.TRBL $
+    vec4
+      (outer topEdge [edges | (spot, edges) <- cells, spot.spotRow == 0])
+      (outer rightEdge [edges | (spot, edges) <- cells, spot.spotColumn + spot.spotColumns == columnCount])
+      (outer bottomEdge [edges | (spot, edges) <- cells, spot.spotRow + spot.spotRows == rowCount])
+      (outer leftEdge [edges | (spot, edges) <- cells, spot.spotColumn == 0])
+  where
+    outer edge = foldl' max 0 . map edge
+
+fillUp :: Float -> [(Int, Float)] -> [(Int, Float)]
+fillUp excess capacities
+  | excess <= 0 || null open = []
+  | null saturated = [(track, share) | (track, _) <- open]
+  | otherwise = saturated <> fillUp (excess - sum (map snd saturated)) [(track, capacity) | (track, capacity) <- open, capacity >= share]
+  where
+    open = filter ((> 0) . snd) capacities
+    share = excess / fromIntegral (length open)
+    saturated = [(track, capacity) | (track, capacity) <- open, capacity < share]
+
+amountFor :: Int -> [(Int, Float)] -> Float
+amountFor track given = sum [amount | (track', amount) <- given, track' == track]
+
+axisRanges :: Int -> [Float] -> [((Int, Int), (Maybe Float, Maybe Float))] -> [(Float, Float)]
+axisRanges count gaps cells =
+  foldl' fitSpan singles spanning
+  where
+    singles =
+      [ case [range | ((lead, 1), range) <- cells, lead == track] of
+          [] -> (0, 0)
+          ranges -> trackRange ranges
+      | track <- [0 .. count - 1]
+      ]
+    spanning = sortOn (snd . fst) [cell | cell@((_first, n), _range) <- cells, n > 1]
+    fitSpan ranges ((lead, n), range@(lo, hi)) =
+      raiseMost $ raiseLeast ranges
+      where
+        spanned = [lead .. lead + n - 1]
+        inner = innerGaps gaps lead n
+        raiseLeast current =
+          [ if track `elem` spanned then let least' = least + amountFor track given + evenly in (least', max most least') else (least, most)
+          | (track, (least, most)) <- zip [0 ..] current
+          ]
+          where
+            excess = fromMaybe 0 lo - (sum [fst (current !! track) | track <- spanned] + inner)
+            given = fillUp excess [(track, snd (current !! track) - fst (current !! track)) | track <- spanned]
+            remaining = max 0 excess - sum (map snd given)
+            evenly = if remaining > 0 then remaining / fromIntegral n else 0
+        raiseMost current
+          | sizedRange range && all (\track -> not . isInfinite . snd $ current !! track) spanned =
+              let
+                excess = fromMaybe 0 hi - (sum [snd (current !! track) | track <- spanned] + inner)
+              in
+                if excess > 0 then
+                  [ if track `elem` spanned then (least, most + excess / fromIntegral n) else (least, most)
+                  | (track, (least, most)) <- zip [0 ..] current
+                  ]
+                else
+                  current
+          | otherwise = current
+
+settleAxis :: Float -> [Float] -> [(Float, Float)] -> [((Int, Int), (Maybe Float, Maybe Float), Float -> Float)] -> [Float]
+settleAxis offered gaps ranges cells =
+  [ maybe (grown !! track) id (lookup track $ zip openTracks openLengths)
+  | track <- [0 .. length ranges - 1]
+  ]
+  where
+    budget = max 0 (offered - sum gaps)
+    indexed = zip [0 :: Int ..] ranges
+    cappedTracks = [track | (track, (_least, most)) <- indexed, not (isInfinite most)]
+    openTracks = [track | (track, (_least, most)) <- indexed, isInfinite most]
+    singlesIn track = [(range, probe) | ((lead, 1), range, probe) <- cells, lead == track]
+    answer track share = trackAnswer [(range, probe share) | (range, probe) <- singlesIn track]
+    cappedLengths =
+      settleTracks (max 0 $ budget - sum [fst (ranges !! track) | track <- openTracks]) (ranges !!) answer cappedTracks
+    start =
+      [ maybe least id (lookup track $ zip cappedTracks cappedLengths)
+      | (track, (least, _most)) <- indexed
+      ]
+    spanning = sortOn (\((_first, n), _range, _probe) -> n) [cell | cell@((_first, n), _range, _probe) <- cells, n > 1]
+    grown = foldl' fitSpan start spanning
+    fitSpan lengths ((lead, n), range, probe)
+      | not (sizedRange range) = lengths
+      | otherwise = [length' + amountFor track given | (track, length') <- zip [0 ..] lengths]
+      where
+        spanned = [lead .. lead + n - 1]
+        current = sum [lengths !! track | track <- spanned] + innerGaps gaps lead n
+        room = max 0 (budget - sum lengths)
+        wanted =
+          case range of
+            (Just lo, Just hi) | lo == hi -> lo
+            _ -> probe (current + room)
+        given = fillUp (wanted - current) [(track, snd (ranges !! track) - lengths !! track) | track <- spanned]
+    openLengths =
+      settleTracks (max 0 $ budget - sum [grown !! track | track <- cappedTracks]) (\track -> (grown !! track, inf)) answer openTracks
+
+topEdge, rightEdge, bottomEdge, leftEdge :: Box.TRBL -> Float
+topEdge edges = withEdges edges \t _r _b _l -> t
+rightEdge edges = withEdges edges \_t r _b _l -> r
+bottomEdge edges = withEdges edges \_t _r b _l -> b
+leftEdge edges = withEdges edges \_t _r _b l -> l
+
+reservedAfter :: (child -> Float) -> [(ix, child)] -> [Float]
+reservedAfter minimumOf = drop 1 . scanr ((+) . minimumOf . snd) 0
+
+fairShare :: Float -> Float -> Float -> Float -> Float
+fairShare ownMinimum reserved remaining childrenRemaining =
+  max ownMinimum $ min (remaining / childrenRemaining) (max 0 $ remaining - reserved)
+
+runOffsets :: [Float] -> [Float] -> ([Float], Float)
+runOffsets gaps lengths =
+  case nonEmpty lengths of
+    Nothing ->
+      ([], 0)
+    Just _ ->
+      (starts, max 0 $ last starts + last lengths)
+  where
+    starts = scanl (+) 0 $ zipWith (+) lengths gaps
+
+shiftRun :: (Float -> Box -> (Box, Box)) -> Alignment.Origin -> Float -> Box -> Box
+shiftRun cut origin slack box =
+  if origin == 0 || slack == 0 then
+    box
+  else
+    snd $ cut (slack * origin) box
+
 widthFlexibility :: ViewSize -> Float
-widthFlexibility ViewSize{..} = maybeBoth (-1) (-) maxWidth minWidth
+widthFlexibility ViewSize{..} = maybeBoth inf (-) maxWidth minWidth
 
 heightFlexibility :: ViewSize -> Float
-heightFlexibility ViewSize{..} = maybeBoth (-1) (-) maxHeight minHeight
+heightFlexibility ViewSize{..} = maybeBoth inf (-) maxHeight minHeight
+
+frameLeast :: Maybe Float -> Maybe Float -> Maybe Float -> Maybe Float
+frameLeast lower upper innerLeast =
+  case (lower, upper) of
+    (Nothing, Nothing) -> innerLeast
+    (Just lo, _) -> Just lo
+    (Nothing, Just hi) -> Just $ min hi (fromMaybe 0 innerLeast)
+
+frameMost :: Maybe Float -> Maybe Float -> Maybe Float -> Maybe Float
+frameMost lower upper innerMost =
+  case (lower, upper) of
+    (Nothing, Nothing) -> innerMost
+    (_, Just hi) -> Just hi
+    (Just lo, Nothing) -> Just $ max lo (fromMaybe inf innerMost)
+
+orderedBounds :: FrameBounds -> FrameBounds
+orderedBounds bounds =
+  bounds
+    { frameMinWidth = lowest bounds.frameMinWidth bounds.frameMaxWidth
+    , frameMaxWidth = highest bounds.frameMinWidth bounds.frameMaxWidth
+    , frameMinHeight = lowest bounds.frameMinHeight bounds.frameMaxHeight
+    , frameMaxHeight = highest bounds.frameMinHeight bounds.frameMaxHeight
+    }
+  where
+    lowest (Just lo) (Just hi) = Just (min lo hi)
+    lowest lo _ = lo
+    highest (Just lo) (Just hi) = Just (max lo hi)
+    highest _ hi = hi
+
+offeredSize :: FrameBounds -> Vec2 -> Vec2
+offeredSize bounds proposed =
+  withVec2 proposed \w h ->
+    vec2 (offered frameMinWidth frameMaxWidth w) (offered frameMinHeight frameMaxHeight h)
+  where
+    FrameBounds{..} = orderedBounds bounds
+    offered lower upper = maybe id min upper . maybe id max lower
+
+framedSize :: FrameBounds -> Vec2 -> Vec2 -> Vec2
+framedSize bounds proposed reported =
+  withVec2 proposed \pw ph ->
+    withVec2 reported \rw rh ->
+      vec2 (framed frameMinWidth frameMaxWidth pw rw) (framed frameMinHeight frameMaxHeight ph rh)
+  where
+    FrameBounds{..} = orderedBounds bounds
+    framed lower upper offer content =
+      maybe id (\hi size -> min hi (max size offer)) upper $
+        maybe content (\lo -> max lo (min content offer)) lower
 
 vsClamp :: Vec2 -> ViewSize -> Vec2 -> Vec2
 vsClamp parent ViewSize{..} v =
diff --git a/test/Examples.hs b/test/Examples.hs
--- a/test/Examples.hs
+++ b/test/Examples.hs
@@ -8,11 +8,12 @@
 import Control.Monad (unless)
 import Data.Foldable (for_)
 import Data.Function ((&))
+import Data.List (genericTake)
 import Data.String (IsString(..))
 import Geomancy.Layout.Alignment qualified as Alignment
 import Geomancy.Layout.Box (Box(..))
 import Geomancy.Layout.Box qualified as Box
-import Geomancy.Layout.View (LayoutView(..), View(..), ViewSize(..), layout)
+import Geomancy.Layout.View (LayoutView(..), View(..), ViewSize(..), hstack_, layout, vstack_)
 import Geomancy.Layout.View qualified as ViewSize
 import Geomancy.Vec2 (Vec2, vec2, pattern WithVec2)
 import Lucid.Svg qualified as SVG
@@ -41,11 +42,14 @@
       HStack{ann, children} -> g_ [class_ "hstack"] $ contents ann "#afa" "" <> for_ children go
       VStack{ann, children} -> g_ [class_ "vstack"] $ contents ann "#aaf" "" <> for_ children go
       ZStack{ann, children} -> g_ [class_ "zstack"] $ contents ann "#faa" "" <> for_ children go
+      Grid{ann, rows} -> g_ [class_ "grid"] $ contents ann "#fdc" "" <> for_ (concat rows) go
       Overlay{primary, secondary} -> g_ [class_ "overlay"] $ go primary <> go secondary
+      Background{primary, secondary} -> g_ [class_ "background"] $ go secondary <> go primary
       Frame{ann, inner} -> g_ [class_ "frame"] $ contents ann "#faf" "" <> go inner
       FlexibleFrame{ann, inner} -> g_ [class_ "flex"] $ contents ann "#ffa" "" <> go inner
       Padding{inner} -> g_ [class_ "padding"] $ go inner -- dashed rect?
       Offset{inner} -> g_ [class_ "offset"] $ go inner -- dashed rect?
+      Span{inner} -> g_ [class_ "span"] $ go inner
       AspectRatio{ann, inner} -> g_ [class_ "aspect"] $ contents ann "#aff" "" <> go inner
 
     svg :: Svg () -> Svg ()
@@ -115,12 +119,8 @@
     Label s -> (vec2 maxWidth 32, (len, e'))
       where
         charWidth = 10
-        maxChars = floor (w / charWidth)
-        trimmed =
-          if maxChars > 0 && maxChars < length s then
-            take maxChars s
-          else
-            s
+        maxChars = max 1 (floor (w / charWidth)) :: Integer
+        trimmed = genericTake maxChars s
         len = length trimmed
         maxWidth = fromIntegral len * charWidth
         e' = Label trimmed
@@ -145,6 +145,8 @@
      Box
        {position = Vec2 400.0 300.0,
         size = Vec2 800.0 600.0},
+   spacing = 0.0,
+   align = Alignment (Vec2 0.0 0.5),
    children =
      [View
         {ann =
@@ -162,7 +164,7 @@
 -}
 exampleHalves :: View () Static
 exampleHalves =
-  HStack ()
+  hstack_
     [ View () "400x600"
     , View () "400x600"
     ]
@@ -175,13 +177,15 @@
      Box
        {position = Vec2 400.0 300.0,
         size = Vec2 800.0 600.0},
+   spacing = 0.0,
+   align = Alignment (Vec2 0.0 0.5),
    children =
      [Frame
         {ann =
            Box
              {position = Vec2 50.0 300.0, size = Vec2 100.0 50.0},
          size = Vec2 100.0 50.0,
-         align = Alignment (Vec2 0.5 0.5),
+         align = Alignment (Vec2 0.5 1.0),
          inner =
            View
              {ann =
@@ -192,7 +196,7 @@
         {ann =
            Box
              {position = Vec2 255.0 300.0,
-              size = Vec2 310.0 600.0}},
+              size = Vec2 310.0 0.0}},
       View
         {ann =
            Box
@@ -202,20 +206,20 @@
       Frame
         {ann =
            Box
-             {position = Vec2 760.0 40.0, size = Vec2 80.0 80.0},
+             {position = Vec2 760.0 300.0, size = Vec2 80.0 80.0},
          size = Vec2 80.0 80.0,
          align = Alignment (Vec2 0.0 0.0),
          inner =
            View
              {ann =
                 Box
-                  {position = Vec2 760.0 40.0, size = Vec2 80.0 80.0},
+                  {position = Vec2 760.0 300.0, size = Vec2 80.0 80.0},
               stuff = "Fixed 80x80"}}]}
 @
 -}
 exampleTree :: View () Static
 exampleTree =
-  HStack ()
+  hstack_
     [ Frame () (vec2 100 50) Alignment.centerBottom $ -- Fixed size
         View () "Fixed 100x50" -- Inherited
     , Spacer () -- Flexible (Infinite)
@@ -240,6 +244,8 @@
           Box
             {position = Vec2 400.0 300.0,
              size = Vec2 800.0 600.0},
+        spacing = 0.0,
+        align = Alignment (Vec2 0.0 0.5),
         children =
           [Frame
              {ann =
@@ -274,7 +280,7 @@
 exampleFramed :: View () Static
 exampleFramed =
   Frame () exampleScreenBox.size Alignment.center $ -- XXX: no-op
-    HStack ()
+    hstack_
       [ Frame () (vec2 400 600) Alignment.center $ View () "400x600"
       , Frame () (vec2 400 600) Alignment.center $ View () "400x600"
       ]
@@ -287,18 +293,24 @@
      Box
        {position = Vec2 400.0 300.0,
         size = Vec2 800.0 600.0},
+   spacing = 0.0,
+   align = Alignment (Vec2 0.0 0.5),
    children =
      [HStack
         {ann =
            Box
              {position = Vec2 400.0 300.0,
               size = Vec2 800.0 600.0},
+         spacing = 0.0,
+         align = Alignment (Vec2 0.0 0.5),
          children =
            [HStack
               {ann =
                  Box
                    {position = Vec2 200.0 300.0,
                     size = Vec2 400.0 600.0},
+               spacing = 0.0,
+               align = Alignment (Vec2 0.0 0.5),
                children =
                  [View
                     {ann =
@@ -311,6 +323,8 @@
                  Box
                    {position = Vec2 600.0 300.0,
                     size = Vec2 400.0 600.0},
+               spacing = 0.0,
+               align = Alignment (Vec2 0.0 0.5),
                children =
                  [View
                     {ann =
@@ -322,10 +336,10 @@
 -}
 exampleNested :: View () Static
 exampleNested =
-  HStack () . pure $ -- XXX: no-op
-    HStack ()
-      [ HStack () [View () "400x600"] -- XXX: no-op wrapped halves
-      , HStack () [View () "400x600"]
+  hstack_ . pure $ -- XXX: no-op
+    hstack_
+      [ hstack_ [View () "400x600"] -- XXX: no-op wrapped halves
+      , hstack_ [View () "400x600"]
       ]
 
 {- | The stack conents is larger than the screen size.
@@ -336,6 +350,8 @@
      Box
        {position = Vec2 550.0 300.0,
         size = Vec2 1100.0 600.0},
+   spacing = 0.0,
+   align = Alignment (Vec2 0.0 0.5),
    children =
      [Frame
         {ann =
@@ -369,7 +385,7 @@
 -}
 exampleOverflow :: View () Static
 exampleOverflow =
-  HStack ()
+  hstack_
     [ Frame () (vec2 500 600) Alignment.center $ View () "500x600"
     , Frame () (vec2 600 600) Alignment.center $ View () "600x600"
     ]
@@ -385,14 +401,14 @@
   Padding () (Box.TRBL 32) $
   Offset () (vec2 0 32) $
   AspectRatio () 1 Alignment.center $
-  HStack ()
-    [ HStack ()
+  hstack_
+    [ hstack_
         [ View () $ Label "very large"
         , View () $ Icon "💅"
         ]
     , Spacer ()
-    , FlexibleFrame () (ViewSize.range_ 60 100 & ViewSize.parentHeight) Alignment.centerTop $
-        HStack ()
+    , FlexibleFrame () (ViewSize.unbounded & ViewSize.widthWithin 60 100 & ViewSize.fillHeight) Alignment.centerTop $
+        hstack_
           [ View () $ Label "very large"
           , View () $ Icon "💅"
           ]
@@ -401,18 +417,18 @@
 exampleDynamicVert :: View () Dynamic
 exampleDynamicVert =
   Padding () (Box.TRBL 32) $
-  ZStack () . (FlexibleFrame () ViewSize.parent_ Alignment.rightBottom (View () $ Icon "✋") :) . pure $ -- this is getting out of hand...
+  ZStack () Alignment.center . (FlexibleFrame () ViewSize.filling Alignment.rightBottom (View () $ Icon "✋") :) . pure $ -- this is getting out of hand...
   Offset () (vec2 0 32) $
   AspectRatio () 1 Alignment.center $
-  VStack ()
-    [ HStack ()
+  vstack_
+    [ hstack_
         [ View () $ Label "very large"
         , View () $ Icon "💅"
         ]
-    , Spacer ()
-        & Overlay () (Frame () 128 Alignment.rightTop . Offset () (vec2 16 (-16)) $ View () $ Icon "🌈")
-    , FlexibleFrame () (ViewSize.range_ 60 100 & ViewSize.parentWidth) Alignment.leftMiddle $
-        HStack ()
+    , ZStack () Alignment.center [Spacer ()]
+        & Overlay () Alignment.rightTop (Frame () 128 Alignment.rightTop . Offset () (vec2 16 (-16)) $ View () $ Icon "🌈")
+    , FlexibleFrame () (ViewSize.unbounded & ViewSize.heightWithin 60 100 & ViewSize.fillWidth) Alignment.leftMiddle $
+        hstack_
           [ View () $ Label "very large"
           , View () $ Icon "💅"
           ]
diff --git a/test/Menu/Grids.hs b/test/Menu/Grids.hs
new file mode 100644
--- /dev/null
+++ b/test/Menu/Grids.hs
@@ -0,0 +1,118 @@
+module Menu.Grids
+  ( tracks
+  , spans
+  , interplay
+  ) where
+
+import Data.Function ((&))
+import Geomancy.Layout.Alignment qualified as Alignment
+import Geomancy.Layout.View
+import Geomancy.Vec2 (vec2)
+import Geomancy.Vec4 (vec4)
+import Menu.Kit
+
+light, dim, columnHue, rowHue, fillHue, smallHue, cellHue, spanHue, panelHue :: String
+light = "#e8e6e0"
+dim = "#a9a7a0"
+columnHue = "#3d5a8f"
+rowHue = "#8f5a3d"
+fillHue = "#4f8f6f"
+smallHue = "#c9a23c"
+cellHue = "#3d5a8f"
+spanHue = "#7a4f8f"
+panelHue = "#5a5f6b"
+
+caption :: String -> UI
+caption = label (font 18 light)
+
+page :: String -> [String] -> [UI] -> UI
+page heading notes body =
+  padding_ (vec4 80 80 80 80) $
+    vstack 24 Alignment.leftTop $
+      label (heavy $ font 34 light) heading
+        : vstack 6 Alignment.leftTop (map (label $ font 18 dim) notes)
+        : body
+
+sized :: String -> String -> Float -> Float -> String -> UI
+sized name hue w h text =
+  frame_ (vec2 w h) $
+    zstack Alignment.center
+      [ fill name (paint hue & rounded 6)
+      , caption text
+      ]
+
+loose :: String -> String -> String -> UI
+loose name hue text =
+  zstack Alignment.center
+    [ fill name (paint hue & faded 0.45 & rounded 6 & rimmed hue)
+    , caption text
+    ]
+
+band :: String -> FrameBounds -> String -> UI
+band name bounds text = flexible_ bounds Alignment.center (loose name spanHue text)
+
+tracks :: UI
+tracks =
+  page "Grid tracks"
+    [ "Columns take their widest sized cell, rows their tallest. Unsized fills take their whole slot without widening it."
+    , "The 60x30 cell is smaller than its slot, so it sits at the slot's top-left, by the grid's alignment."
+    ]
+    [ grid 12 12 Alignment.leftTop
+        [ [spacer_, sized "col 1" columnHue 260 60 "260 wide", sized "col 2" columnHue 140 60 "140 wide", sized "col 3" columnHue 380 60 "380 wide"]
+        , [sized "row 1" rowHue 120 50 "50 tall", loose "r1c1" fillHue "unsized", loose "r1c2" fillHue "unsized", loose "r1c3" fillHue "unsized"]
+        , [sized "row 2" rowHue 120 120 "120 tall", loose "r2c1" fillHue "unsized", sized "small" smallHue 60 30 "60x30", loose "r2c3" fillHue "unsized"]
+        , [sized "row 3" rowHue 120 80 "80 tall", loose "r3c1" fillHue "unsized", loose "r3c2" fillHue "unsized", loose "r3c3" fillHue "unsized"]
+        ]
+    ]
+
+spans :: UI
+spans =
+  page "Grid spans"
+    [ "Cells fill the grid row by row, skipping slots that earlier row spans cover. A span stops at a slot that is already taken."
+    , "Right: a fixed header wider than the two columns under it grows both of them evenly."
+    ]
+    [ hstack 80 Alignment.leftTop
+        [ grid 12 12 Alignment.leftTop
+            [ [span_ 3 1 (band "header" (unbounded & heightWithin 56 56 & fillWidth) "span 3 x 1"), sized "corner" cellHue 140 56 "140 x 56"]
+            , [span_ 1 2 (band "sidebar" (unbounded & widthWithin 160 160 & fillHeight) "span 1 x 2"), sized "a" cellHue 140 70 "140 x 70", sized "b" cellHue 140 70 "140 x 70", span_ 1 3 (band "tall" filling "span 1 x 3")]
+            , [span_ 2 1 (band "wide" (unbounded & heightWithin 70 70 & fillWidth) "span 2 x 1")]
+            , [span_ 4 1 (band "cut" (unbounded & heightWithin 56 56 & fillWidth) "span 4 x 1, cut to 3")]
+            ]
+        , grid 12 12 Alignment.leftTop
+            [ [span_ 2 1 (sized "wide header" spanHue 400 50 "400 wide, over two 140 columns")]
+            , [sized "left" cellHue 140 60 "140", sized "right" cellHue 140 60 "140"]
+            ]
+        ]
+    ]
+
+interplay :: UI
+interplay =
+  page "Grids with other views"
+    [ "Left: a spacer column pushes values to the panel's right edge, a divider spans every column, and a background sits behind the grid."
+    , "Right: 16:9 cards keep their height in a row, captions centre under them, and a badge overlays a card. Below: a grid with an open column fills a row."
+    ]
+    [ hstack 60 Alignment.leftTop [settings, cards]
+    , hstack 0 Alignment.leftTop
+        [ grid 12 0 Alignment.leftTop [[sized "fixed A" cellHue 200 60 "200 wide", spacer_, sized "fixed B" cellHue 200 60 "200 wide"]]
+        , sized "panel" panelHue 300 60 "300 wide panel"
+        ]
+    ]
+  where
+    settings =
+      flexible_ (unbounded & widthWithin 640 640) Alignment.leftTop $
+        backdrop "settings panel" (paint "#1d2230" & rounded 10 & rimmed "#3a4560") $
+          padding_ (vec4 20 20 20 20) $
+            grid 24 14 Alignment.leftMiddle
+              [ [caption "Master volume", spacer_, caption "80%"]
+              , [caption "Resolution", spacer_, caption "1920 x 1080"]
+              , [caption "V-Sync", spacer_, caption "On"]
+              , [span_ 3 1 (divider "settings rule" (paint "#3a4560"))]
+              , [caption "Language", spacer_, caption "English"]
+              ]
+    cards =
+      grid 16 8 Alignment.center
+        [ [card "card 1" "#6b2a2a", card "card 2" "#2a4a6b", overlay Alignment.rightTop badge (card "card 3" "#2a6b44")]
+        , [caption "Expansion", caption "Season pass", caption "Soundtrack"]
+        ]
+    card name hue = flexible_ (unbounded & widthWithin 240 240) Alignment.center $ aspect_ (vec2 16 9) (art name (paint hue & rimmed "#ffffff40"))
+    badge = offset_ (vec2 8 (-8)) $ glyph "badge" (paint "#e0b040" & rounded 6) 26 Tile "!"
diff --git a/test/Menu/Harbour.hs b/test/Menu/Harbour.hs
new file mode 100644
--- /dev/null
+++ b/test/Menu/Harbour.hs
@@ -0,0 +1,152 @@
+module Menu.Harbour
+  ( harbour
+  ) where
+
+import Data.Function ((&))
+import Geomancy.Layout.Alignment qualified as Alignment
+import Geomancy.Layout.View
+import Geomancy.Vec2 (vec2)
+import Geomancy.Vec4 (vec4)
+import Menu.Kit
+
+cream, gold, dim :: String
+cream = "#efe2c2"
+gold = "#d9b45a"
+dim = "#b9a780"
+
+harbour :: UI
+harbour =
+  zstack Alignment.center
+    [ art "key art: harbour at dawn" (paint "#7a5a2e")
+    , hstack 0 Alignment.leftTop
+        [ padding_ (vec4 0 0 0 73) sidebar
+        , spacer_
+        , newsColumn
+        ]
+    ]
+
+sidebar :: UI
+sidebar =
+  zstack Alignment.centerTop
+    [ flexible_ (unbounded & widthWithin 330 330 & fillHeight) Alignment.center $
+        fill "strip" (paint "#2b2217" & faded 0.82)
+    , flexible_ (unbounded & widthWithin 384 384 & fillHeight) Alignment.centerTop $
+        padding_ (vec4 64 0 40 0) $
+          vstack 14 Alignment.centerTop
+            [ logo
+            , resumeCard
+            , vstack 4 Alignment.centerTop
+                [ label (serif $ font 32 cream) "New Voyage"
+                , label (serif $ font 32 cream) "Multiplayer"
+                , label (serif $ font 28 cream) "Load Game"
+                ]
+            , ornament "ornament 1"
+            , label (serif $ font 26 dim) "Expansions"
+            , expansions
+            , ornament "ornament 2"
+            , vstack 4 Alignment.centerTop
+                [ label (serif $ font 28 cream) "Captains' Club"
+                , label (serif $ font 28 cream) "Options"
+                , label (serif $ font 28 cream) "Credits"
+                ]
+            , spacer_
+            , label (serif $ font 28 cream) "Quit Game"
+            ]
+    ]
+
+logo :: UI
+logo =
+  vstack 0 Alignment.centerTop
+    [ frame_ (vec2 (textWidth wordmark "TIDEWRIGHT") (lineHeight wordmark)) (label wordmark "TIDEWRIGHT")
+    , label (serif $ font 26 cream) "~ 1871 ~"
+    ]
+  where
+    wordmark = heavy . serif $ font 60 gold
+
+resumeCard :: UI
+resumeCard =
+  backdrop "resume card" (paint "#3a2856" & faded 0.96 & rounded 4 & rimmed "#8d79c4") $
+    vstack 0 Alignment.centerTop
+      [ hstack 0 Alignment.leftTop
+          [ Frame () (vec2 150 124) Alignment.centerBottom $ frame_ (vec2 150 150) (roomy (vec4 46 0 0 0) $ art "portrait" (paint "#4b5d73"))
+          , flexible_ (fillWidth unbounded) Alignment.centerTop $
+              padding_ (vec4 14 8 10 8) $
+                vstack 4 Alignment.centerTop
+                  [ label (heavy . serif $ font 22 cream) "Capt. Ilse Varga"
+                  , zstack Alignment.center
+                      [ frame_ (vec2 150 2) (fill "medallion line" (paint gold & faded 0.6))
+                      , glyph "medallion" (paint "#3f7f5a" & rimmed gold) 22 Disc ""
+                      ]
+                  , label (font 15 cream) "SANDBOX"
+                  , hstack 6 Alignment.leftMiddle
+                      [ glyph "trait 1" (paint "#a8642c") 18 Tile ""
+                      , glyph "trait 2" (paint "#5c8a3a") 18 Tile ""
+                      , glyph "trait 3" (paint "#c9a03a") 18 Tile ""
+                      ]
+                  ]
+          ]
+      , divider "resume separator" (paint gold & faded 0.5)
+      , padding_ (vec4 6 0 8 0) $ label (font 17 cream) "CONTINUE"
+      ]
+
+ornament :: String -> UI
+ornament name =
+  zstack Alignment.center
+    [ frame_ (vec2 290 2) $ roomy (vec4 22 0 22 0) $ fill (name <> " line") (paint gold & faded 0.5)
+    , glyph name (paint gold) 12 Diamond ""
+    ]
+
+expansions :: UI
+expansions =
+  grid 10 12 Alignment.center
+    [ map expansion [1 .. 5]
+    , map expansion [6 .. 10]
+    ]
+
+expansion :: Int -> UI
+expansion i =
+  decorate $ glyph ("exp " <> show i) (paint hue & rimmed "#e8d7a8") 50 Disc ""
+  where
+    hue = ["#3b3b3b", "#c46a3c", "#4f8f6f", "#c9a23c", "#3d4f8f", "#5a3b2b", "#7a5a3a", "#2f5f7f", "#4b3d6f", "#2b2b2b"] !! (i - 1)
+    locked = i `elem` [1, 5, 6, 7, 8, 9, 10]
+    starred = i `elem` [5, 6, 7, 8, 9]
+    decorate base =
+      (if starred then overlay Alignment.rightBottom (offset_ (vec2 7 7) $ glyph ("star " <> show i) (paint "#ffd54a") 22 Star "") else id) $
+        (if locked then overlay Alignment.center (glyph ("lock " <> show i) (paint "#111" & faded 0.7 & rounded 4) 20 Tile "") else id) base
+
+newsColumn :: UI
+newsColumn =
+  padding_ (vec4 24 6 6 0) $
+    vstack 12 Alignment.rightTop
+      [ glyph "status" (paint "#4fd16b") 44 Ring ""
+      , spacer_
+      , padding_ (vec4 0 34 0 0) $
+          vstack 16 Alignment.centerTop
+            [ overlay Alignment.leftMiddle gears $ newsCard "news 1" "Join the Captains' Guild" "#55606b"
+            , newsCard "news 2" "The soundtrack is out now!" "#1f3a4a"
+            , hstack 8 Alignment.leftMiddle
+                [ glyph "pip 1" (paint cream) 18 Ring ""
+                , glyph "pip 2" (paint cream) 10 Disc ""
+                , glyph "pip 3" (paint cream) 10 Disc ""
+                ]
+            ]
+      , label (font 15 dim) "build 0.48.2210"
+      ]
+  where
+    gears =
+      offset_ (vec2 (-14) (-40)) $
+        vstack 2 Alignment.center
+          [ glyph "gear 1" (paint "#8a8f5a") 26 Disc ""
+          , glyph "gear 2" (paint "#8a8f5a") 18 Disc ""
+          ]
+
+newsCard :: String -> String -> String -> UI
+newsCard name caption hue =
+  frame_ (vec2 400 250) $
+    overlay Alignment.leftBottom
+      ( backdrop (name <> " strip") (paint "#000" & faded 0.55) $
+          flexible_ (fillWidth unbounded) Alignment.leftMiddle $
+            padding_ (vec4 6 10 8 10) $
+              named (name <> " caption") $ label (heavy . serif $ font 22 cream) caption
+      )
+      (art name (paint hue & rimmed "#00000080"))
diff --git a/test/Menu/Iron.hs b/test/Menu/Iron.hs
new file mode 100644
--- /dev/null
+++ b/test/Menu/Iron.hs
@@ -0,0 +1,132 @@
+module Menu.Iron
+  ( iron
+  ) where
+
+import Data.Function ((&))
+import Geomancy.Layout.Alignment (Alignment(..), pattern Begin, pattern End)
+import Geomancy.Layout.Alignment qualified as Alignment
+import Geomancy.Layout.View
+import Geomancy.Vec2 (vec2)
+import Geomancy.Vec4 (vec4)
+import Menu.Kit
+
+gold, steel, cream :: String
+gold = "#f0c04a"
+steel = "#6b6f78"
+cream = "#e6e0d0"
+
+leftBottom :: Alignment
+leftBottom = Alignment (vec2 Begin End)
+
+pin :: Alignment -> UI -> UI
+pin = flexible_ filling
+
+iron :: UI
+iron =
+  zstack Alignment.center
+    [ art "key art: storm over the pass" (paint "#2f4a52")
+    , pin Alignment.leftTop $ padding_ (vec4 70 0 0 85) leftBlock
+    , pin Alignment.rightBottom dock
+    ]
+
+leftBlock :: UI
+leftBlock =
+  vstack 14 Alignment.centerTop
+    [ framedPanel
+    , label (font 22 cream) "0.9.4.2213 beta x86_64 2026-11-30 15:29"
+    ]
+
+framedPanel :: UI
+framedPanel =
+  overlay Alignment.centerTop (offset_ (vec2 0 (-44)) hooks) $
+    corner Alignment.leftTop (vec2 14 14) "rivet tl" $
+      corner Alignment.rightTop (vec2 (-14) 14) "rivet tr" $
+        corner Alignment.leftBottom (vec2 14 (-14)) "rivet bl" $
+          corner Alignment.rightBottom (vec2 (-14) (-14)) "rivet br" $
+            backdrop "panel" (paint "#3a2a1c" & rounded 6 & rimmed steel) $
+              padding_ (vec4 110 40 56 40) $
+                flexible_ (unbounded & widthWithin 500 500) Alignment.centerTop $
+                  vstack 30 Alignment.centerTop
+                    [ vstack 0 Alignment.centerTop
+                        [ label (heavy . serif $ font 70 gold) "EMBERMARK"
+                        , label (serif $ font 30 "#e9a64a") "ANNIVERSARY"
+                        ]
+                    , vstack 18 Alignment.centerTop
+                        [ resumePlate
+                        , menuRow "Campaign" False
+                        , selected $ menuRow "Skirmish" True
+                        , menuRow "Custom Games" False
+                        , menuRow "Replays" True
+                        , menuRow "Armory" False
+                        ]
+                    ]
+  where
+    corner align shift name = overlay align (offset_ shift $ glyph name (paint "#8a8f99") 12 Disc "")
+    hooks =
+      hstack 0 Alignment.leftTop
+        [ spacer_
+        , glyph "hook 1" (paint "#4a4d55" & rounded 10 & rimmed "#2a2b30") 64 Tile ""
+        , spacer_
+        , spacer_
+        , glyph "hook 2" (paint "#4a4d55" & rounded 10 & rimmed "#2a2b30") 64 Tile ""
+        , spacer_
+        ]
+
+resumePlate :: UI
+resumePlate =
+  frame_ (vec2 400 92) $
+    zstack Alignment.leftMiddle
+      [ fill "resume plate" (paint "#2a2b30" & rounded 8 & rimmed gold)
+      , padding_ (vec4 0 0 0 24) $
+          grid 12 2 Alignment.leftMiddle
+            [ [spacer_, label (heavy $ font 22 cream) "CONTINUE"]
+            , [glyph "resume icon" (paint gold) 12 PointRight "", label (font 16 "#cfc6b0") "NOV 30, 2026, 11:16:58 PM"]
+            ]
+      ]
+
+selected :: UI -> UI
+selected row =
+  zstack Alignment.center
+    [ hstack 0 Alignment.leftMiddle
+        [ glyph "arrow left" (paint gold) 24 PointRight ""
+        , spacer_
+        , glyph "arrow right" (paint gold) 24 PointLeft ""
+        ]
+    , row
+    ]
+
+menuRow :: String -> Bool -> UI
+menuRow title active =
+  overlay Alignment.leftMiddle (offset_ (vec2 10 0) $ glyph (title <> " rivet l") (paint "#8a8f99") 14 Disc "") $
+    overlay Alignment.rightMiddle (offset_ (vec2 (-10) 0) $ glyph (title <> " rivet r") (paint "#8a8f99") 14 Disc "") $
+      frame_ (vec2 400 76) $
+        zstack Alignment.center
+          [ fill (title <> " plate") (paint "#24252a" & rounded 8 & rimmed steel)
+          , frame_ (vec2 330 56) $
+              zstack Alignment.center
+                [ fill (title <> " face") (paint (if active then "#1d3a9a" else "#141416") & rounded 6 & rimmed (if active then "#6f8cff" else "#3a3b40"))
+                , label (heavy $ font 24 (if active then "#ffd84a" else "#8d8e93")) title
+                ]
+          ]
+
+dock :: UI
+dock =
+  vstack 0 Alignment.rightTop
+    [ padding_ (vec4 0 28 0 0) $
+        offset_ (vec2 0 10) $
+          hstack 10 leftBottom
+            [ glyph "friend add" (paint "#1d3a9a" & rounded 4 & rimmed "#8aa0ff") 50 Tile "+"
+            , glyph "avatar" (paint "#5b7a3a" & rounded 4 & rimmed "#c9c9c9") 76 Tile ""
+            ]
+    , backdrop "dock" (paint "#1c1d22" & rimmed steel) $
+        frame_ (vec2 940 96) $
+          padding_ (vec4 18 28 18 16) $
+            hstack 12 Alignment.leftMiddle
+              [ backdrop "chat field" (paint "#050506" & rounded 6 & rimmed "#4a4a50") $
+                  flexible_ (between (vec2 0 60) (vec2 inf 60)) Alignment.leftMiddle $
+                    padding_ (vec4 0 16 0 16) $
+                      hstack 0 Alignment.leftMiddle [label (font 22 "#e8d9a8") "[1. General]:", spacer_]
+              , glyph "friends" (paint "#1d3a9a" & rounded 4 & rimmed "#8aa0ff") 60 Tile "*"
+              , glyph "menu" (paint "#1d3a9a" & rounded 4 & rimmed "#8aa0ff") 60 Tile "="
+              ]
+    ]
diff --git a/test/Menu/Jungle.hs b/test/Menu/Jungle.hs
new file mode 100644
--- /dev/null
+++ b/test/Menu/Jungle.hs
@@ -0,0 +1,109 @@
+module Menu.Jungle
+  ( jungle
+  ) where
+
+import Data.Function ((&))
+import Geomancy.Layout.Alignment (Alignment(..), pattern Begin, pattern End)
+import Geomancy.Layout.Alignment qualified as Alignment
+import Geomancy.Layout.View
+import Geomancy.Vec2 (vec2)
+import Geomancy.Vec4 (vec4)
+import Menu.Kit
+
+ice, dimInk, sand :: String
+ice = "#e9f2ff"
+dimInk = "#9aa3b5"
+sand = "#c8b98a"
+
+leftBottom :: Alignment
+leftBottom = Alignment (vec2 Begin End)
+
+pin :: Alignment -> UI -> UI
+pin = flexible_ filling
+
+jungle :: UI
+jungle =
+  zstack Alignment.center
+    [ art "key art: overgrown ruins" (paint "#25413f")
+    , vstack 0 Alignment.leftTop
+        [ flexible_ (between (vec2 0 136) (vec2 inf 136)) Alignment.center $ fill "top band" (paint "#0b1418" & faded 0.6)
+        , divider "top band line" (paint "#6fb6d0" & faded 0.6)
+        , padding_ (vec4 0 0 0 81) $ offset_ (vec2 0 (-48)) wordmark
+        , padding_ (vec4 36 0 0 0) $
+            vstack 12 Alignment.leftTop
+              [ bar "Continue" 520 64 30 False True
+              , bar "New Expedition" 740 64 30 True False
+              , bar "Options" 520 64 30 False False
+              , bar "Credits" 520 64 30 False False
+              , bar "Quit" 520 64 30 False False
+              ]
+        , spacer_
+        , padding_ (vec4 0 59 36 0) $
+            hstack 0 leftBottom
+              [ vstack 10 Alignment.leftTop
+                  [ bar "Profile: Delta" 520 64 34 False False
+                  , bar "Achievements" 450 44 24 False False
+                  , bar "Statistics" 450 44 24 False False
+                  ]
+              , spacer_
+              , hstack 40 Alignment.leftTop
+                  [ vstack 8 Alignment.centerTop
+                      [ card "card 1" "#7a1f1f" "#e04a3a"
+                      , label (font 16 "#4fd16b") "New Expansion Available"
+                      ]
+                  , card "card 2" "#1f4a6a" "#5fb0e0"
+                  , card "card 3" "#2f5a3a" "#5fb0e0"
+                  ]
+              ]
+        , footer
+        ]
+    ]
+
+wordmark :: UI
+wordmark =
+  hstack 14 leftBottom
+    [ label (heavy $ font 96 ice) "SALT"
+    , label (heavy $ font 40 ice) "of the"
+    , label (heavy $ font 96 ice) "DEEP"
+    ]
+
+bar :: String -> Float -> Float -> Float -> Bool -> Bool -> UI
+bar title width height points chosen disabled =
+  frame_ (vec2 width height) $
+    zstack Alignment.leftMiddle
+      [ fill ("bar " <> title) (paint (if chosen then "#b8a774" else "#15151c") & faded (if chosen then 0.95 else 0.78))
+      , padding_ (vec4 0 0 0 81) $ label (heavy $ font points (if disabled then dimInk else ice)) title
+      ]
+
+card :: String -> String -> String -> UI
+card name hue edge =
+  flexible_ (unbounded & widthWithin 244 244) Alignment.center $
+    aspect_ (vec2 16 9) $
+      art name (paint hue & rimmed edge)
+
+footer :: UI
+footer =
+  flexible_ (between (vec2 0 100) (vec2 inf 100)) Alignment.center $
+    zstack Alignment.center
+      [ fill "footer band" (paint "#081014" & faded 0.85)
+      , pin Alignment.leftTop $ divider "footer line" (paint "#6fb6d0" & faded 0.5)
+      , label (font 18 sand) "(c) 2026 Placeholder Games"
+      , pin Alignment.leftTop $ padding_ (vec4 22 0 0 81) $ label (font 18 dimInk) "v0.303.43287"
+      , pin Alignment.rightMiddle $
+          padding_ (vec4 0 40 0 0) $
+            hstack 12 Alignment.leftMiddle
+              [ outlined "CREATE ACCOUNT"
+              , outlined "LOG IN"
+              , padding_ (vec4 0 0 0 28) $ glyph "publisher" (paint "#d8d8d8" & rounded 8) 64 Tile "P"
+              , padding_ (vec4 0 0 0 28) $ glyph "studio" (paint "#d8d8d8" & rounded 8) 64 Tile "S"
+              ]
+      ]
+  where
+    buttonFont = font 18 ice
+    widest = maximum (map (textWidth buttonFont) ["CREATE ACCOUNT", "LOG IN"])
+    outlined caption =
+      frame_ (vec2 (widest + 64) 44) $
+        zstack Alignment.center
+          [ fill ("button " <> caption) (paint "#0b1418" & faded 0.6 & rimmed "#6fb6d0")
+          , label buttonFont caption
+          ]
diff --git a/test/Menu/Kit.hs b/test/Menu/Kit.hs
new file mode 100644
--- /dev/null
+++ b/test/Menu/Kit.hs
@@ -0,0 +1,174 @@
+module Menu.Kit
+  ( UI
+  , Widget(..)
+  , Look(..)
+  , Mark(..)
+  , Paint(..)
+  , Font(..)
+  , paint
+  , faded
+  , rounded
+  , rimmed
+  , font
+  , heavy
+  , serif
+  , textWidth
+  , lineHeight
+  , widget
+  , label
+  , named
+  , fill
+  , art
+  , glyph
+  , roomy
+  , backdrop
+  , divider
+  ) where
+
+import Data.Char (isDigit, isLower, isUpper)
+import Geomancy.Layout.Alignment qualified as Alignment
+import Geomancy.Layout.Box qualified as Box
+import Geomancy.Layout.View
+import Geomancy.Vec2 (vec2, withVec2)
+import Geomancy.Vec4 (Vec4)
+
+type UI = View () Widget
+
+data Widget = Widget
+  { name :: String
+  , look :: Look
+  , room :: Vec4
+  }
+  deriving (Eq, Show)
+
+data Look
+  = Fill Paint
+  | Art Paint String
+  | Label Font String
+  | Glyph Paint Float Mark String
+  deriving (Eq, Show)
+
+data Mark = Disc | Ring | Tile | Diamond | Star | PointLeft | PointRight | Blank
+  deriving (Eq, Show)
+
+data Paint = Paint
+  { tint :: String
+  , alpha :: Float
+  , corner :: Float
+  , rim :: Maybe String
+  }
+  deriving (Eq, Show)
+
+data Font = Font
+  { points :: Float
+  , ink :: String
+  , bold :: Bool
+  , roman :: Bool
+  }
+  deriving (Eq, Show)
+
+paint :: String -> Paint
+paint tint = Paint{tint, alpha = 1, corner = 0, rim = Nothing}
+
+faded :: Float -> Paint -> Paint
+faded alpha p = p{alpha}
+
+rounded :: Float -> Paint -> Paint
+rounded corner p = p{corner}
+
+rimmed :: String -> Paint -> Paint
+rimmed colour p = p{rim = Just colour}
+
+font :: Float -> String -> Font
+font points ink = Font{points, ink, bold = False, roman = False}
+
+heavy :: Font -> Font
+heavy f = f{bold = True}
+
+serif :: Font -> Font
+serif f = f{roman = True}
+
+textWidth :: Font -> String -> Float
+textWidth f s = f.points * sum (map glyphWidth s) * if f.bold then 1.07 else 1
+  where
+    glyphWidth c
+      | c == ' ' = 0.3
+      | c == '…' = 0.9
+      | isUpper c = 0.68
+      | isDigit c = 0.56
+      | isLower c = 0.52
+      | otherwise = 0.4
+
+lineHeight :: Font -> Float
+lineHeight f = f.points * 1.3
+
+shortest :: String -> String
+shortest s =
+  case s of
+    _ : _ : _ -> take 1 s <> "…"
+    _ -> s
+
+fitText :: Font -> Float -> String -> String
+fitText f width s
+  | textWidth f s <= width = s
+  | otherwise =
+      case [cut | n <- [length s - 1, length s - 2 .. 1], let cut = take n s <> "…", textWidth f cut <= width] of
+        cut : _ -> cut
+        [] -> if textWidth f s < textWidth f (shortest s) then s else shortest s
+
+instance LayoutView Widget where
+  viewFlexibility w =
+    (base w.look){clearance = Box.TRBL w.room}
+    where
+      base = \case
+        Fill{} -> infinite_
+        Art{} -> infinite_
+        Label f s ->
+          range_
+            (vec2 (textWidth f $ shortest s) (lineHeight f))
+            (vec2 (textWidth f s) (lineHeight f))
+        Glyph _ side _ _ -> fixed_ (vec2 side side)
+
+  proposeView proposed w =
+    case w.look of
+      Fill{} -> (proposed, w)
+      Art{} -> (proposed, w)
+      Label f s ->
+        let
+          shown = withVec2 proposed \width _height -> fitText f width s
+        in
+          (vec2 (textWidth f shown) (lineHeight f), w{look = Label f shown})
+      Glyph _ side _ _ -> (vec2 side side, w)
+
+  placeView _placed = id
+
+widget :: String -> Look -> UI
+widget name look = view_ Widget{name, look, room = 0}
+
+label :: Font -> String -> UI
+label f s = widget s (Label f s)
+
+named :: String -> UI -> UI
+named name = \case
+  View{ann, stuff} -> View{ann, stuff = stuff{name}}
+  other -> other
+
+fill :: String -> Paint -> UI
+fill name p = widget name (Fill p)
+
+art :: String -> Paint -> UI
+art name p = widget name (Art p name)
+
+glyph :: String -> Paint -> Float -> Mark -> String -> UI
+glyph name p side mark caption = widget name (Glyph p side mark caption)
+
+roomy :: Vec4 -> UI -> UI
+roomy trbl = \case
+  View{ann, stuff} -> View{ann, stuff = stuff{room = trbl}}
+  other -> other
+
+backdrop :: String -> Paint -> UI -> UI
+backdrop name p = background Alignment.center (fill name p)
+
+divider :: String -> Paint -> UI
+divider name p = flexible_ (between (vec2 0 2) (vec2 inf 2)) Alignment.center (fill name p)
diff --git a/test/Menu/Probe.hs b/test/Menu/Probe.hs
new file mode 100644
--- /dev/null
+++ b/test/Menu/Probe.hs
@@ -0,0 +1,106 @@
+module Menu.Probe
+  ( invariants
+  ) where
+
+import Geomancy.Layout.Box (Box)
+import Geomancy.Layout.Box qualified as Box
+import Geomancy.Layout.View (View(..))
+import Geomancy.Vec2 (Vec2, withVec2)
+import Menu.Kit
+import Numeric (showFFloat)
+
+data Edge = L | T | R | B
+
+edgeOf :: Edge -> Box -> Float
+edgeOf e box =
+  Box.withTRBL box \t r b l ->
+    case e of
+      L -> l
+      T -> t
+      R -> r
+      B -> b
+
+leaves :: View Box Widget -> [(Widget, Box)]
+leaves = \case
+  View{ann, stuff} -> [(stuff, ann)]
+  node -> concatMap leaves (subviews node)
+
+subviews :: View ann stuff -> [View ann stuff]
+subviews = \case
+  View{} -> []
+  Spacer{} -> []
+  HStack{children} -> children
+  VStack{children} -> children
+  ZStack{children} -> children
+  Grid{rows} -> concat rows
+  Overlay{primary, secondary} -> [primary, secondary]
+  Background{primary, secondary} -> [secondary, primary]
+  Frame{inner} -> [inner]
+  FlexibleFrame{inner} -> [inner]
+  Padding{inner} -> [inner]
+  Offset{inner} -> [inner]
+  Span{inner} -> [inner]
+  AspectRatio{inner} -> [inner]
+
+num :: Float -> String
+num x
+  | isNaN x = "NaN"
+  | isInfinite x = if x > 0 then "inf" else "-inf"
+  | x == fromIntegral (round x :: Int) = show (round x :: Int)
+  | otherwise = showFFloat (Just 1) x ""
+
+invariants :: Vec2 -> View Box Widget -> [String]
+invariants screen tree =
+  broken tree <> offscreen <> overlaps tree
+  where
+    broken node =
+      [ "bad size in " <> kind node <> " " <> describe node.ann
+      | Box.withTRBL node.ann \t r b l -> any isNaN [t, r, b, l] || r - l < -0.01 || b - t < -0.01
+      ]
+        <> concatMap broken (subviews node)
+
+    offscreen =
+      withVec2 screen \sw sh ->
+        [ "off screen: " <> w.name <> " " <> describe box
+        | (w, box) <- leaves tree
+        , Box.withTRBL box \t r b l -> l < -0.5 || t < -0.5 || r > sw + 0.5 || b > sh + 0.5
+        ]
+
+    overlaps node =
+      case node of
+        HStack{children} -> pairs R L children <> concatMap overlaps children
+        VStack{children} -> pairs B T children <> concatMap overlaps children
+        _ -> concatMap overlaps (subviews node)
+
+    pairs trailing leading children =
+      [ "overlap in stack: " <> firstName a <> " / " <> firstName b <> " by " <> num (edgeOf trailing a.ann - edgeOf leading b.ann)
+      | (a, b) <- zip children (drop 1 children)
+      , edgeOf leading b.ann < edgeOf trailing a.ann - 0.5
+      ]
+
+    firstName node =
+      case leaves node of
+        (w, _) : _ -> w.name
+        [] -> kind node
+
+describe :: Box -> String
+describe box =
+  Box.withTRBL box \t r b l ->
+    "x " <> num l <> ".." <> num r <> " y " <> num t <> ".." <> num b
+
+kind :: View ann stuff -> String
+kind = \case
+  View{} -> "View"
+  Spacer{} -> "Spacer"
+  HStack{} -> "HStack"
+  VStack{} -> "VStack"
+  ZStack{} -> "ZStack"
+  Grid{} -> "Grid"
+  Overlay{} -> "Overlay"
+  Background{} -> "Background"
+  Frame{} -> "Frame"
+  FlexibleFrame{} -> "FlexibleFrame"
+  AspectRatio{} -> "AspectRatio"
+  Padding{} -> "Padding"
+  Offset{} -> "Offset"
+  Span{} -> "Span"
diff --git a/test/Menu/Svg.hs b/test/Menu/Svg.hs
new file mode 100644
--- /dev/null
+++ b/test/Menu/Svg.hs
@@ -0,0 +1,210 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+module Menu.Svg
+  ( renderMenu
+  ) where
+
+import Control.Monad (when)
+import Data.Foldable (traverse_)
+import Data.String (IsString, fromString)
+import Geomancy.Layout.Box (Box)
+import Geomancy.Layout.Box qualified as Box
+import Geomancy.Layout.View (View(..))
+import Geomancy.Vec2 (Vec2, withVec2)
+import Lucid.Svg
+import Menu.Kit
+
+renderMenu :: Bool -> Vec2 -> View Box Widget -> Svg ()
+renderMenu outlines screen tree =
+  withVec2 screen \w h -> do
+    doctype_
+    with
+      ( svg11_ do
+          definitions
+          rect_ [width_ "100%", height_ "100%", fill_ "#101014"]
+          content tree
+          when outlines (frames tree)
+      )
+      [ version_ "1.1"
+      , width_ (num w)
+      , height_ (num h)
+      , viewBox_ ("0 0 " <> num w <> " " <> num h)
+      ]
+
+definitions :: Svg ()
+definitions =
+  defs_ do
+    linearGradient_ [id_ "shade", x1_ "0", y1_ "0", x2_ "0", y2_ "1"] do
+      stop_ [offset_ "0", stop_color_ "#000", stop_opacity_ "0"]
+      stop_ [offset_ "1", stop_color_ "#000", stop_opacity_ "0.6"]
+    pattern_ [id_ "hatch", width_ "28", height_ "28", patternUnits_ "userSpaceOnUse"] do
+      path_ [d_ "M-7,7 L7,-7 M0,28 L28,0 M21,35 L35,21", stroke_ "#fff", stroke_opacity_ "0.08", stroke_width_ "6"]
+
+content :: View Box Widget -> Svg ()
+content = \case
+  View{ann, stuff} -> drawWidget ann stuff
+  Spacer{} -> pure ()
+  HStack{children} -> traverse_ content children
+  VStack{children} -> traverse_ content children
+  ZStack{children} -> traverse_ content children
+  Grid{rows} -> traverse_ content (concat rows)
+  Overlay{primary, secondary} -> content primary >> content secondary
+  Background{primary, secondary} -> content secondary >> content primary
+  Frame{inner} -> content inner
+  FlexibleFrame{inner} -> content inner
+  Padding{inner} -> content inner
+  Offset{inner} -> content inner
+  Span{inner} -> content inner
+  AspectRatio{inner} -> content inner
+
+drawWidget :: Box -> Widget -> Svg ()
+drawWidget box w =
+  case w.look of
+    Fill p -> panel box p
+    Art p caption -> do
+      panel box p
+      panel box (paint "url(#hatch)"){corner = p.corner}
+      panel box (paint "url(#shade)"){corner = p.corner}
+      corners box \_t r b l ->
+        text_
+          [ x_ (num $ (l + r) / 2)
+          , y_ (num $ b - 14)
+          , font_size_ "15"
+          , font_family_ "sans-serif"
+          , font_style_ "italic"
+          , text_anchor_ "middle"
+          , fill_ "#fff"
+          , fill_opacity_ "0.45"
+          ]
+          (fromString caption)
+    Label f s ->
+      corners box \t r _b l ->
+        text_
+          [ x_ (num l)
+          , y_ (num $ t + f.points * 1.02)
+          , font_size_ (num f.points)
+          , font_family_ (if f.roman then "Georgia, serif" else "Helvetica, Arial, sans-serif")
+          , font_weight_ (if f.bold then "bold" else "normal")
+          , fill_ (fromString f.ink)
+          , textLength_ (num $ max 0 (r - l))
+          , lengthAdjust_ "spacingAndGlyphs"
+          ]
+          (fromString s)
+    Glyph p side mark caption -> do
+      shape box p mark
+      when (not $ null caption) $
+        corners box \t r b l ->
+          text_
+            [ x_ (num $ (l + r) / 2)
+            , y_ (num $ (t + b) / 2 + side * 0.17)
+            , font_size_ (num $ side * 0.46)
+            , font_family_ "Helvetica, Arial, sans-serif"
+            , font_weight_ "bold"
+            , text_anchor_ "middle"
+            , fill_ "#fff"
+            , fill_opacity_ "0.85"
+            ]
+            (fromString caption)
+
+shape :: Box -> Paint -> Mark -> Svg ()
+shape box p = \case
+  Disc -> corners box \t r b l -> circle_ ([cx_ (num $ (l + r) / 2), cy_ (num $ (t + b) / 2), r_ (num $ (r - l) / 2)] <> painted p)
+  Ring -> corners box \t r b l -> circle_ ([cx_ (num $ (l + r) / 2), cy_ (num $ (t + b) / 2), r_ (num $ (r - l) / 2 - 1.5), fill_ "none", stroke_ (fromString p.tint), stroke_width_ "3"])
+  Tile -> panel box p
+  Diamond -> polygonIn box p [(0.5, 0), (1, 0.5), (0.5, 1), (0, 0.5)]
+  Star -> polygonIn box p [ (0.5 + 0.5 * k * sin a, 0.5 - 0.5 * k * cos a) | i <- [0 .. 9 :: Int], let a = fromIntegral i * pi / 5, let k = if even i then 1 else 0.45 ]
+  PointLeft -> polygonIn box p [(1, 0), (0, 0.5), (1, 1)]
+  PointRight -> polygonIn box p [(0, 0), (1, 0.5), (0, 1)]
+  Blank -> pure ()
+
+polygonIn :: Box -> Paint -> [(Float, Float)] -> Svg ()
+polygonIn box p unit =
+  corners box \t r b l ->
+    polygon_
+      ( points_ (fromString $ unwords [show (l + u * (r - l)) <> "," <> show (t + v * (b - t)) | (u, v) <- unit])
+          : painted p
+      )
+
+panel :: Box -> Paint -> Svg ()
+panel box p =
+  corners box \t r b l ->
+    rect_
+      ( [ x_ (num l)
+        , y_ (num t)
+        , width_ (num $ max 0 (r - l))
+        , height_ (num $ max 0 (b - t))
+        , rx_ (num p.corner)
+        ]
+          <> painted p
+      )
+
+painted :: Paint -> [Attribute]
+painted p =
+  [fill_ (fromString p.tint), fill_opacity_ (num p.alpha)]
+    <> maybe [] (\colour -> [stroke_ (fromString colour), stroke_width_ "2"]) p.rim
+
+frames :: View Box Widget -> Svg ()
+frames node = do
+  traverse_ frames (subviews node)
+  corners node.ann \t r b l ->
+    rect_
+      ( [ x_ (num l)
+        , y_ (num t)
+        , width_ (num $ max 0 (r - l))
+        , height_ (num $ max 0 (b - t))
+        , fill_ "none"
+        , stroke_ (outlineColour node)
+        , stroke_width_ "1"
+        , stroke_opacity_ "0.9"
+        ]
+          <> [stroke_dasharray_ "4 3" | dashed node]
+      )
+
+dashed :: View ann stuff -> Bool
+dashed = \case
+  Spacer{} -> True
+  Padding{} -> True
+  Offset{} -> True
+  _ -> False
+
+outlineColour :: IsString s => View ann stuff -> s
+outlineColour = \case
+  View{} -> "#ffffff"
+  Spacer{} -> "#7fb7ff"
+  HStack{} -> "#3dff6e"
+  VStack{} -> "#5c7cff"
+  ZStack{} -> "#ff5c5c"
+  Grid{} -> "#c8a2ff"
+  Overlay{} -> "#ffa23d"
+  Background{} -> "#a2ff3d"
+  Frame{} -> "#ff4fd8"
+  FlexibleFrame{} -> "#ffe14f"
+  AspectRatio{} -> "#4fffe9"
+  Padding{} -> "#9a9a9a"
+  Offset{} -> "#4fd2ff"
+  Span{} -> "#d2ff4f"
+
+subviews :: View ann stuff -> [View ann stuff]
+subviews = \case
+  View{} -> []
+  Spacer{} -> []
+  HStack{children} -> children
+  VStack{children} -> children
+  ZStack{children} -> children
+  Grid{rows} -> concat rows
+  Overlay{primary, secondary} -> [primary, secondary]
+  Background{primary, secondary} -> [secondary, primary]
+  Frame{inner} -> [inner]
+  FlexibleFrame{inner} -> [inner]
+  Padding{inner} -> [inner]
+  Offset{inner} -> [inner]
+  Span{inner} -> [inner]
+  AspectRatio{inner} -> [inner]
+
+corners :: Box -> (Float -> Float -> Float -> Float -> r) -> r
+corners = Box.withTRBL
+
+num :: IsString s => Float -> s
+num x =
+  fromString $
+    if x == fromIntegral (round x :: Int) then show (round x :: Int) else show x
diff --git a/test/Spec.hs b/test/Spec.hs
--- a/test/Spec.hs
+++ b/test/Spec.hs
@@ -1,15 +1,52 @@
+{-# LANGUAGE OverloadedStrings #-}
+
 import Prelude
 
+import Data.Foldable (toList)
+
 import Test.Tasty
 import Test.Tasty.HUnit
+import System.Directory (createDirectoryIfMissing)
 
+import Geomancy.Layout.Alignment (Alignment(..), pattern End, pattern Middle)
+import Geomancy.Layout.Alignment qualified as Alignment
+import Geomancy.Layout.Box (Box(..))
+import Geomancy.Layout.Box qualified as Box
+import Geomancy.Layout.View (View(..), ViewSize(..))
+import Geomancy.Layout.View qualified as View
+import Geomancy.Vec2 (Vec2, vec2, withVec2)
+import Geomancy.Vec4 (vec4)
+
+import Lucid.Svg (renderToFile)
+
 import Examples
+import Menu.Grids (interplay, spans, tracks)
+import Menu.Harbour (harbour)
+import Menu.Iron (iron)
+import Menu.Jungle (jungle)
+import Menu.Kit (UI)
+import Menu.Probe (invariants)
+import Menu.Svg (renderMenu)
 
 main :: IO ()
-main = defaultMain tests
+main = do
+  createDirectoryIfMissing True "examples/menus"
+  createDirectoryIfMissing True "examples/grid"
+  defaultMain tests
 
 tests :: TestTree
-tests = testGroup "Examples"
+tests = testGroup "geomancy-layout"
+  [ examples
+  , showcases
+  , stacks
+  , frames
+  , aspects
+  , grids
+  , clearances
+  ]
+
+examples :: TestTree
+examples = testGroup "Examples"
   [ testCase "Tree" $ toSVGfile "examples/Tree.svg" exampleTree
   , testCase "Halves" $ toSVGfile "examples/Halves.svg" exampleHalves
   , testCase "Overflow" $ toSVGfile "examples/Overflow.svg" exampleOverflow
@@ -18,3 +55,255 @@
   , testCase "Dynamic" $ toSVGfile "examples/Dynamic.svg" exampleDynamic
   , testCase "DynamicVert" $ toSVGfile "examples/DynamicVert.svg" exampleDynamicVert
   ]
+
+showcases :: TestTree
+showcases = testGroup "Showcases"
+  [ showcase "examples/menus" "Harbour" harbour
+  , showcase "examples/menus" "Iron" iron
+  , showcase "examples/menus" "Jungle" jungle
+  , showcase "examples/grid" "Tracks" tracks
+  , showcase "examples/grid" "Spans" spans
+  , showcase "examples/grid" "Interplay" interplay
+  ]
+
+showcase :: FilePath -> String -> UI -> TestTree
+showcase directory name tree =
+  testCase name do
+    let file suffix = directory <> "/" <> name <> suffix <> ".svg"
+    renderToFile (file "") (renderMenu False screen placed)
+    renderToFile (file "-outline") (renderMenu True screen placed)
+    invariants screen placed @?= []
+  where
+    screen = vec2 1920 1080
+    placed = View.layout Box{position = screen / 2, size = screen} tree
+
+stacks :: TestTree
+stacks = testGroup "Stacks"
+  [ testCase "Main-axis alignment moves the run" $
+      childBoxes exampleScreenBox (View.hstack 0 (Alignment $ vec2 End Middle) [square "a"])
+        @?= [Box{position = vec2 750 300, size = vec2 100 50}]
+
+  , testCase "A spacer under a zero proposal stays empty" $ do
+      let
+        zeroHigh = Box{position = vec2 100 0, size = vec2 200 0}
+        tree = View.vstack_ [View.frame_ (vec2 200 50) (View () "a"), View.spacer_ :: View () Static]
+      fst (View.suspend zeroHigh.size $ View.measure tree) @?= vec2 200 50
+      map (.size) (childBoxes zeroHigh tree) @?= [vec2 200 50, vec2 0 0]
+
+  , testCase "Spacers follow their stack through modifiers" $
+      (View.measure $ View.hstack_ [View.padding_ 5 (View.spacer_ :: View () Static)]).ann
+        @?= View.range_ (vec2 10 10) (vec2 (1 / 0) 10)
+
+  , testCase "Negative spacing never makes a stack's size negative" $ do
+      let
+        tree = View.hstack (-30) Alignment.leftTop [View.frame_ (vec2 10 10) (View () "a"), View.frame_ (vec2 10 10) (View () "b")] :: View () Static
+        measured = (View.measure tree).ann
+      (measured.minWidth, measured.maxWidth) @?= (Just 0, Just 0)
+      fst (View.suspend (vec2 400 100) $ View.measure tree) @?= vec2 0 10
+
+  , testCase "Parent-sized views get what their siblings leave" $
+      map Box.width (childBoxes row $ View.hstack_ [leaf 100 100, View.viewFun View.parent_ \proposed -> (proposed, const ())])
+        @?= [100, 300]
+
+  , testCase "Long stacks place their last child where they report" $ do
+      let
+        root = Box{position = vec2 50 0, size = vec2 100 10}
+        tree = View.vstack 3.7 Alignment.leftTop $ replicate 5000 (View.frame_ (vec2 10 20.3) (View () "x")) :: View () Static
+        reported = fst (View.suspend root.size $ View.measure tree)
+        lastBottom = Box.withTRBL (last $ childBoxes root tree) \_t _r b _l -> b
+        top = Box.withTRBL root \t _r _b _l -> t
+      assertBool (show (lastBottom - top, reported)) $
+        abs (lastBottom - top - snd' reported) < 0.5
+
+  , testCase "Traversal runs back to front" $ do
+      toList
+        ( View.overlay Alignment.centerBottom (View.view_ "label") $
+            View.background Alignment.center (View.view_ "gradient") $
+              View.padding_ 4 $
+                View.background Alignment.center (View.view_ "circle") $
+                  View.padding_ 6 (View.view_ "icon")
+        )
+        @?= ["gradient", "circle", "icon", "label" :: String]
+      toList (View.zstack_ [View.view_ "back", View.view_ "front"]) @?= ["back", "front" :: String]
+      toList (View.grid_ [[View.view_ "a", View.view_ "b"], [View.view_ "c"]]) @?= ["a", "b", "c" :: String]
+  ]
+  where
+    square label = View.frame_ (vec2 100 50) (View () label) :: View () Static
+    leaf lo hi =
+      View.viewFun
+        (View.range_ (vec2 lo 10) (vec2 hi 10))
+        \proposed -> withVec2 proposed \w _h -> (vec2 (min hi $ max lo w) 10, const ())
+
+frames :: TestTree
+frames = testGroup "Flexible frames"
+  [ testCase "Size like SwiftUI's flexible frame" $ do
+      sized (View.between (vec2 0 44) (vec2 (1 / 0) 44)) @?= vec2 400 44
+      sized View.unbounded @?= vec2 30 20
+      sized (View.fillWidth View.unbounded) @?= vec2 400 20
+      sized View.unbounded{View.frameMinWidth = Just 50} @?= vec2 50 20
+      sized View.unbounded{View.frameMaxWidth = Just 80} @?= vec2 80 20
+      sized View.unbounded{View.frameMinWidth = Just 100, View.frameMaxWidth = Just 50} @?= vec2 100 20
+
+  , testCase "Measure the range they can report" $ do
+      measured (View.between (vec2 0 64) (vec2 (1 / 0) 64)) @?= View.range_ (vec2 0 64) (vec2 (1 / 0) 64)
+      measured View.unbounded @?= View.fixed_ (vec2 30 20)
+      measured (View.fillWidth View.unbounded) @?= View.range_ (vec2 30 20) (vec2 (1 / 0) 20)
+      measured View.unbounded{View.frameMinWidth = Just 50} @?= View.fixed_ (vec2 50 20)
+      measured View.unbounded{View.frameMaxWidth = Just 80} @?= View.range_ (vec2 30 20) (vec2 80 20)
+      measured View.unbounded{View.frameMinWidth = Just 100, View.frameMaxWidth = Just 50} @?= View.range_ (vec2 50 20) (vec2 100 20)
+      (View.measure $ View.flexible_ (View.between 60 100) Alignment.center (View.viewFun View.parent_ \proposed -> (proposed, const ()))).ann
+        @?= View.range_ 60 100
+  ]
+  where
+    framed bounds = View.flexible_ bounds Alignment.center (View.frame_ (vec2 30 20) (View () "a") :: View () Static)
+    sized bounds =
+      case childBoxes row (View.hstack_ [framed bounds]) of
+        [box] -> box.size
+        _ -> vec2 (-1) (-1)
+    measured bounds = (View.measure $ framed bounds).ann
+
+aspects :: TestTree
+aspects = testGroup "Aspect ratio"
+  [ testCase "Letterboxes content that cannot take the ratio" $ do
+      wrapped [] 1 1 capped @?= (vec2 120 120, vec2 120 120)
+      wrapped [] 1 1 tile @?= (vec2 30 30, vec2 30 20)
+      wrapped [piece (View.fixed_ (vec2 50 20)) (const (vec2 50 20))] 1 1 View.spacer_ @?= (vec2 200 200, vec2 200 0)
+      wrapped [] 1 1 textLike @?= (vec2 100 100, vec2 100 20)
+      case View.layout screen (View.hstack_ [View.aspect_ 1 tile]) of
+        HStack{children = [AspectRatio{ann, inner}]} ->
+          (ann, inner.ann) @?= (Box{position = vec2 15 100, size = vec2 30 30}, Box{position = vec2 15 100, size = vec2 30 20})
+        _ -> assertFailure "expected a row holding an AspectRatio"
+
+  , testCase "Measures the range it can report" $ do
+      (View.measure $ View.aspect_ 1 tile).ann @?= View.fixed_ (vec2 30 30)
+      (View.measure $ View.aspect_ 1 capped).ann @?= View.range_ (vec2 0 0) (vec2 120 120)
+
+  , testCase "Only a positive finite quotient counts" $ do
+      wrapped [] (-4) (-1) art @?= (vec2 400 100, vec2 400 100)
+      wrapped [] (-1) 1 tile @?= (vec2 30 20, vec2 30 20)
+      wrapped [] 1 0 tile @?= (vec2 30 20, vec2 30 20)
+      wrapped [] 0 0 art @?= (vec2 400 200, vec2 400 200)
+      (View.measure $ View.aspect_ 0 tile).ann @?= View.fixed_ (vec2 30 20)
+  ]
+  where
+    screen = Box{position = vec2 200 100, size = vec2 400 200}
+    piece size answer = View.viewFun size \proposed -> (answer proposed, const ())
+    art = piece View.infinite_ id
+    capped = piece (View.range_ (vec2 0 0) (vec2 120 (1 / 0))) \proposed -> withVec2 proposed \w h -> vec2 (min 120 w) h
+    tile = piece (View.fixed_ (vec2 30 20)) (const (vec2 30 20))
+    textLike = piece (View.range_ (vec2 10 20) (vec2 100 20)) \proposed -> withVec2 proposed \w _h -> vec2 (max 10 $ min 100 w) 20
+    wrapped before aw ah child =
+      case View.layout screen (View.hstack_ $ before <> [View.aspect_ (vec2 aw ah) child]) of
+        HStack{children} | AspectRatio{ann, inner} <- last children -> (ann.size, inner.ann.size)
+        _ -> (vec2 (-1) (-1), vec2 (-1) (-1))
+
+grids :: TestTree
+grids = testGroup "Grid"
+  [ testCase "Unsized cells count only their minimum" $
+      (View.measure $ View.grid_ [[tile 30 20], [View.viewFun (View.range_ (vec2 40 0) (vec2 (1 / 0) (1 / 0))) \proposed -> (proposed, const ())]]).ann.minWidth
+        @?= Just 40
+
+  , testCase "Gaps follow the clearances cells ask for" $ do
+      let tree = View.grid 4 0 Alignment.leftTop [[edgy 3 10 0 2 30 20, edgy 5 0 1 6 30 20]]
+      reported (vec2 400 200) tree @?= vec2 70 20
+      (View.measure tree).ann.clearance @?= Box.TRBL (vec4 5 0 1 2)
+      reported (vec2 400 200) (View.grid 0 0 Alignment.leftTop [[View.span_ 2 1 (edgy 0 10 0 0 60 20), tile 20 20], [tile 30 20, tile 30 20, tile 20 20]])
+        @?= vec2 90 40
+
+  , testCase "Spanning cells get room before open tracks and fill capped tracks first" $ do
+      map Box.width (cells (Box{position = vec2 50 10, size = vec2 100 20}) $ View.grid_ [[label, View.spacer_]])
+        @?= [100, 0]
+      map Box.width (cells screen $ View.grid_ [[View.span_ 2 1 label], [tile 30 20, tile 30 20, View.spacer_]])
+        @?= [100, 30, 30, 300]
+      map (.position) (drop 1 $ cells (Box{position = vec2 50 20, size = vec2 100 40}) $ View.grid_ [[View.span_ 2 1 (tile 100 20)], [tile 30 20, capped]])
+        @?= [vec2 17.5 30, vec2 67.5 30]
+      reported (vec2 400 200) (View.grid_ [[View.span_ 2 1 (View.aspect_ (vec2 2 1) art)], [tile 50 20, tile 50 20]])
+        @?= vec2 100 70
+
+  , testCase "Span edge cases" $ do
+      reported (vec2 400 200) (View.grid_ [[View.span_ 2 2 (tile 60 60), tile 20 20], [tile 20 20]]) @?= vec2 80 60
+      reported (vec2 400 200) (View.grid_ [[View.span_ 1 3 (tile 20 40), tile 20 20]]) @?= vec2 40 40
+      reported (vec2 400 200) (View.grid_ [[View.padding_ 0 (View.span_ 2 1 (tile 100 20))], [tile 30 20, tile 30 20]]) @?= vec2 100 40
+      (View.measure $ View.grid_ [[View.span_ 2 1 label]]).ann @?= View.range_ (vec2 10 20) (vec2 100 20)
+      (View.measure $ View.span_ 2 2 (tile 30 20)).ann @?= View.fixed_ (vec2 30 20)
+
+  , testCase "Reported sizes stay inside the measured range" $
+      sequence_
+        [ assertBool (show (offer, size, range)) $ inside size range
+        | tree <- samples
+        , let range = (View.measure tree).ann
+        , offer <- [vec2 0 0, vec2 (orZero range.minWidth) (orZero range.minHeight), vec2 400 200, vec2 1e6 1e6]
+        , let size = reported offer tree
+        ]
+
+  , testCase "Degenerate grids report sane sizes" $
+      sequence_
+        [ assertBool (show size) $ withVec2 size \w h -> not (isNaN w || isNaN h) && w >= 0 && h >= 0
+        | tree <- [View.grid_ [], View.grid_ [[]], View.grid_ [[View.spacer_, View.spacer_], [View.spacer_]], View.grid (-50) (-50) Alignment.center [[tile 30 20, tile 30 20], [tile 30 20]]]
+        , offer <- [vec2 0 0, vec2 400 200]
+        , let size = reported offer tree
+        ]
+  ]
+  where
+    screen = Box{position = vec2 200 100, size = vec2 400 200}
+    tile w h = View.viewFun (View.fixed_ (vec2 w h)) \_proposed -> (vec2 w h, const ())
+    art = View.viewFun View.infinite_ \proposed -> (proposed, const ())
+    label = View.viewFun (View.range_ (vec2 10 20) (vec2 100 20)) \proposed -> withVec2 proposed \w _h -> (vec2 (max 10 $ min 100 w) 20, const ())
+    capped = View.viewFun (View.range_ (vec2 0 20) (vec2 60 20)) \proposed -> withVec2 proposed \w _h -> (vec2 (min 60 w) 20, const ())
+    edgy t r b l w h = View.viewFun (View.fixed_ (vec2 w h)){clearance = Box.TRBL (vec4 t r b l)} \_proposed -> (vec2 w h, const ())
+    samples =
+      [ View.grid 5 7 Alignment.leftTop [[View.spacer_, tile 40 30], [tile 20 20, art]]
+      , View.grid_ [[View.span_ 2 1 (tile 100 20)], [tile 30 20, capped]]
+      , View.grid_ [[View.span_ 2 1 label], [tile 30 20, tile 30 20, View.spacer_]]
+      , View.grid_ [[View.span_ 2 1 (View.aspect_ (vec2 2 1) art)], [tile 50 20, tile 50 20]]
+      , View.grid_ [[tile 20 20, View.span_ 1 2 (tile 20 40)], [View.span_ 2 1 (tile 40 20)]]
+      , View.grid_ [[View.span_ 2 1 label, tile 20 20], [tile 20 20, View.span_ 2 1 label]]
+      ]
+    reported offer tree = fst (View.suspend offer $ View.measure tree)
+    cells root tree =
+      case View.layout root tree of
+        Grid{rows} -> map (.ann) (concat rows)
+        _ -> []
+    orZero = maybe 0 id
+    inside size range =
+      withVec2 size \w h ->
+        within w range.minWidth range.maxWidth && within h range.minHeight range.maxHeight
+    within value lo hi = maybe True (<= value + 0.01) lo && maybe True (>= value - 0.01) hi
+
+clearances :: TestTree
+clearances = testGroup "Clearance"
+  [ testCase "Gaps take the larger of spacing and clearance" $ do
+      tops (View.vstack 4 Alignment.leftTop [block 10 0 10, block 10 6 0]) @?= [0, 20]
+      tops (View.vstack 12 Alignment.leftTop [block 10 0 10, block 10 6 0]) @?= [0, 22]
+      tops (View.vstack (-4) Alignment.leftTop [block 10 0 0, block 10 0 0]) @?= [0, 6]
+      tops (View.vstack (-4) Alignment.leftTop [block 10 0 0, block 10 6 0]) @?= [0, 16]
+
+  , testCase "Padding counts toward clearance" $ do
+      (View.measure $ View.padding_ (vec4 2 0 0 0) (block 10 6 6)).ann.clearance @?= Box.TRBL (vec4 4 0 6 0)
+      tops (View.vstack 0 Alignment.leftTop [block 20 0 0, View.padding_ (vec4 1 0 0 0) (block 20 10 0)]) @?= [0, 29]
+      tops (View.vstack 0 Alignment.leftTop [block 20 0 0, View.padding_ (vec4 12 0 0 0) (block 20 10 0)]) @?= [0, 20]
+      tops (View.vstack 0 Alignment.leftTop [block 10 0 0, View.padding_ (vec4 (-5) 0 0 0) (block 10 0 0)]) @?= [0, 10]
+  ]
+  where
+    block height top bottom =
+      View.viewFun
+        (View.fixed_ (vec2 100 height)){clearance = Box.TRBL (vec4 top 0 bottom 0)}
+        \_proposed -> (vec2 100 height, const ())
+    tops tree =
+      [ Box.withTRBL box \t _r _b _l -> t
+      | box <- childBoxes Box{position = vec2 50 50, size = vec2 100 100} tree
+      ]
+
+row :: Box
+row = Box{position = vec2 200 50, size = vec2 400 100}
+
+snd' :: Vec2 -> Float
+snd' v = withVec2 v \_x y -> y
+
+childBoxes :: View.LayoutView stuff => Box -> View () stuff -> [Box]
+childBoxes root tree =
+  case View.layout root tree of
+    HStack{children} -> map (.ann) children
+    VStack{children} -> map (.ann) children
+    ZStack{children} -> map (.ann) children
+    _ -> []
