Design tool Vanilla JS + SVG No new dependencies

Corner Concentricity Playground

Nested rounded rectangles look right when their corners share a centre. Build a stack, compare radius strategies, inspect the live geometry, and export code that matches the canvas.

The rule
rinner = router − spacing

Only true while the radius stays above the minimum and inside the layer bounds. The playground flags every exception.

Live geometry

Canvas

Drag to move. Drag the r handles to change the outer radius. Scroll to zoom.

100%
Nested rounded rectangles Interactive preview. Use the controls to change dimensions, radius, spacing, mode, and guides.
Starting points

Preset gallery

Each preset loads a real configuration into the canvas. Change anything afterwards.

Step by step

Visual explanation

Walk the stack. The canvas highlights the layer and the text uses the live numbers.

Layer 1 of 6

The outer layer sets the reference

The outer shape sets the reference corner centre. Inner layers are judged against it.

Jump to a layer

Tip: hover any layer on the canvas to inspect it.

Same dimensions

Compare radius strategies

Four stacks with the same width, height, layer count, spacing and outer radius. Only the radius rule changes.

Concentric

ri = r0 − i · spacing

—

Independent

Same radius on every layer; inner corners drift.

—

Fixed

Every layer uses the fixed radius setting.

—

Proportional

Radius scales with each layer width.

—

Comparison uses circular corners so the radius relationship is easy to see. Smooth mode is not included here.

Live values

Geometry inspector

Computed geometry for each nested layer.

Computed geometry for each nested layer
# Inset Size Radius Corner centre Status Drift
Take it with you

Code & exports

The generated code uses the same computed radii as the canvas.

SwiftUI uses native RoundedRectangle and includes a verified ConcentricRectangle alternative for iOS 26+.

Loading geometry...
Export
Assumptions

What is exact, what is approximate

Exact circular concentricity

For a uniform inset s and circular corners, the inner radius is r − s and the corner centre stays at (r, r). This holds while the radius stays above the minimum and below half the layer shorter side.

Minimum radius is a floor

If the mode formula would go below the minimum, the floor is applied after the fact and the corner centre moves. The inspector reports the drift in pixels instead of pretending the corner is still concentric.

Minimum-dimension mode is different

The Minimum geometry mode uses half the layer shorter side, producing pill-shaped corners. Because a uniform inset shrinks the layer and the radius by the same amount, its corner centres stay aligned until the minimum floor or a layer bound interferes.

Smooth mode is an approximation

Smooth mode replaces each circular arc with a cubic Bézier corner. It is visually smoother, but it is not mathematically identical to a circular concentric corner, a true superellipse, or Apple continuous corner curve.

Platform code

SwiftUI uses native RoundedRectangle and includes a verified ConcentricRectangle alternative for iOS 26+/macOS 26+. Compose draws the computed path because it has no concentric-corner primitive. CSS border-radius cannot express the cubic smooth path, so the CSS smooth export is labelled approximate; the SVG export is exact to the engine path.

The geometry engine is unit-tested in Node. The page runs without a framework or new runtime dependency. Exports are generated in the browser from the same geometry object used by the canvas.

Top