Skip to content

Commit 5674cee

Browse files
committed
docs: the container reference and the layout guide state the twelve padding steps; changeset
Claude-Session: https://claude.ai/code/session_01XvhGmGAP79ZB8swnkapxPC Co-authored-by: Claude <noreply@anthropic.com>
1 parent bff5aa9 commit 5674cee

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
'@object-ui/types': minor
3+
'@object-ui/components': minor
4+
---
5+
6+
A `container` node's `padding` is one of the twelve steps its renderer maps: 0 to 8, 10, 12
7+
and 16. Any other number is refused at validation, with the set named (objectui#11424).
8+
9+
**Breaking for a `container` that carries any other `padding` number.** The key was declared
10+
as any number, but the `container` renderer has one padding class per step and nothing for
11+
the rest. So `padding: 9` or `padding: 20` parsed clean and the container rendered with no
12+
padding class at all, not even the default `4`, because the default applies only when the key
13+
is absent.
14+
15+
- `@object-ui/types`: `ContainerSchema.padding` is the literal union
16+
`0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 12 | 16` on the TypeScript face, so `tsc` refuses
17+
any other number. The zod mirror refuses one at `padding` (`invalid_value`, with the twelve
18+
values in the issue), with a message that lists the set. `safeValidateSchema` (what
19+
`objectui validate` runs) and the strict authoring face both give that refusal.
20+
- `@object-ui/components`: the `container` registration's `padding` input changes from
21+
`type: 'number'` to a closed `enum` of the same twelve numbers, in the object form
22+
`maxWidth` already uses. In the SDUI manifest, `validateTree` now answers an unlisted number
23+
with `invalid-enum`, and the generated intrinsics type the prop as the twelve literals. The
24+
renderer is unchanged: it does not round or clamp, and an absent key still renders the
25+
default step `4`.
26+
27+
Migration: replace the number with the step you meant from the set. `0` means no padding.

‎content/docs/components/layout/container.mdx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ interface ContainerSchema {
2222
maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl'
2323
| '7xl' | 'full' | 'screen' | false; // default: 'xl'
2424
centered?: boolean; // default: true
25-
padding?: number; // 0, 1-8, 10, 12, 16 — default: 4
25+
padding?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 12 | 16; // default: 4
2626
className?: string;
2727
}
2828
```
29+
30+
`padding` is a step on the container's spacing scale, and `0` means none. The twelve
31+
steps are the ones the renderer maps to a padding class, so they are the only values
32+
validation accepts: `"padding": 9` or `"padding": 20` is refused with the set named
33+
(objectui#11424). Such a number used to pass validation and then render with no padding
34+
at all, not even the default.

‎content/docs/guide/layout.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,8 @@ the sidebar are nodes you build, so style them where you build them, as above.
712712

713713
A `page` node has no padding switch. Its wrapper always insets the content: `p-3`, then
714714
`md:p-4`, then `lg:p-6`. The padding you control is a `container`'s. Its `padding` is a
715-
number on the container's spacing scale, and `0` means none:
715+
step on the container's spacing scale: one of 0 to 8, 10, 12 or 16, and `0` means none.
716+
Any other number is refused:
716717

717718
```json
718719
{

0 commit comments

Comments
 (0)