Makepad Layout Skill
Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19
Check for updates: https://crates.io/crates/makepad-widgets
You are an expert at Makepad layout system. Help users by:
- Writing code: Generate layout code following the patterns below
- Answering questions: Explain layout concepts, sizing, flow directions
When to Use
- You need to size, align, or position widgets in a Makepad UI.
- The task involves
Walk, Align, Fit, Fill, padding, spacing, or container flow configuration.
- You want Makepad-specific layout solutions for centering, responsiveness, or composition.
Documentation
Refer to the local files for detailed documentation:
./references/layout-system.md - Complete layout reference
./references/core-types.md - Walk, Align, Margin, Padding types
IMPORTANT: Documentation Completeness Check
Before answering questions, Claude MUST:
- Read the relevant reference file(s) listed above
- If file read fails or file is empty:
- Inform user: "本地文档不完整,建议运行
/sync-crate-skills makepad --force 更新文档"
- Still answer based on SKILL.md patterns + built-in knowledge
- If reference file exists, incorporate its content into the answer
Key Patterns
1. Basic Layout Container
<View> {
width: Fill
height: Fill
flow: Down
padding: 16.0
spacing: 8.0
<Label> { text: "Item 1" }
<Label> { text: "Item 2" }
}
2. Centering Content
<View> {
width: Fill
height: Fill
align: { x: 0.5, y: 0.5 }
<Label> { text: "Centered" }
}
3. Horizontal Row Layout
<View> {
width: Fill
height: Fit
flow: Right
spacing: 10.0
align: { y: 0.5 } // Vertically center items
<Button> { text: "Left" }
<View> { width: Fill } // Spacer
<Button> { text: "Right" }
}
4. Fixed + Flexible Layout
<View> {
width: Fill
height: Fill
flow: Down
// Fixed header
<View> {
width: Fill
height: 60.0
}
// Flexible content
<View> {
width: Fill
height: Fill // Takes remaining space
}
}
Layout Properties Reference
| Property |
Type |
Description |
width |
Size |
Width of element |
height |
Size |
Height of element |
padding |
Padding |
Inner spacing |
margin |
Margin |
Outer spacing |
flow |
Flow |
Child layout direction |
spacing |
f64 |
Gap between children |
align |
Align |
Child alignment |
clip_x |
bool |
Clip horizontal overflow |
clip_y |
bool |
Clip vertical overflow |
Size Values
| Value |
Description |
Fit |
Size to fit content |
Fill |
Fill available space |
100.0 |
Fixed size in pixels |
Fixed(100.0) |
Explicit fixed size |
Flow Directions
| Value |
Description |
Down |
Top to bottom (column) |
Right |
Left to right (row) |
Overlay |
Stack on top |
Align Values
| Value |
Position |
{ x: 0.0, y: 0.0 } |
Top-left |
{ x: 0.5, y: 0.0 } |
Top-center |
{ x: 1.0, y: 0.0 } |
Top-right |
{ x: 0.0, y: 0.5 } |
Middle-left |
{ x: 0.5, y: 0.5 } |
Center |
{ x: 1.0, y: 0.5 } |
Middle-right |
{ x: 0.0, y: 1.0 } |
Bottom-left |
{ x: 0.5, y: 1.0 } |
Bottom-center |
{ x: 1.0, y: 1.0 } |
Bottom-right |
Box Model
+---------------------------+
| margin |
| +---------------------+ |
| | padding | |
| | +---------------+ | |
| | | content | | |
| | +---------------+ | |
| +---------------------+ |
+---------------------------+
When Writing Code
- Use
Fill for flexible containers, Fit for content-sized elements
- Set
flow: Down for vertical, flow: Right for horizontal
- Use empty
<View> { width: Fill } as spacer in row layouts
- Always set explicit dimensions on fixed-size elements
- Use
align to position children within container
When Answering Questions
- Makepad uses a "turtle" layout model - elements laid out sequentially
Fill takes all available space, Fit shrinks to content
- Unlike CSS flexbox, there's no flex-grow/shrink - use Fill/Fit
- Alignment applies to children, not the element itself
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
1---
2name: makepad-layout
3description: |
4 CRITICAL: Use for Makepad layout system. Triggers on:
5 makepad layout, makepad width, makepad height, makepad flex,
6 makepad padding, makepad margin, makepad flow, makepad align,
7 Fit, Fill, Size, Walk, "how to center in makepad",
8 makepad 布局, makepad 宽度, makepad 对齐, makepad 居中
9risk: safe
10source: community
11metadata:
12 source: https://skillmd.com/skills/arjumaan/makepad-layout
13---
14
15# Makepad Layout Skill
16
17> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-19
18>
19> Check for updates: https://crates.io/crates/makepad-widgets
20
21You are an expert at Makepad layout system. Help users by:
22- **Writing code**: Generate layout code following the patterns below
23- **Answering questions**: Explain layout concepts, sizing, flow directions
24
25## When to Use
26- You need to size, align, or position widgets in a Makepad UI.
27- The task involves `Walk`, `Align`, `Fit`, `Fill`, padding, spacing, or container flow configuration.
28- You want Makepad-specific layout solutions for centering, responsiveness, or composition.
29
30## Documentation
31
32Refer to the local files for detailed documentation:
33- `./references/layout-system.md` - Complete layout reference
34- `./references/core-types.md` - Walk, Align, Margin, Padding types
35
36## IMPORTANT: Documentation Completeness Check
37
38**Before answering questions, Claude MUST:**
39
401. Read the relevant reference file(s) listed above
412. If file read fails or file is empty:
42 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"
43 - Still answer based on SKILL.md patterns + built-in knowledge
443. If reference file exists, incorporate its content into the answer
45
46## Key Patterns
47
48### 1. Basic Layout Container
49
50```rust
51<View> {
52 width: Fill
53 height: Fill
54 flow: Down
55 padding: 16.0
56 spacing: 8.0
57
58 <Label> { text: "Item 1" }
59 <Label> { text: "Item 2" }
60}
61```
62
63### 2. Centering Content
64
65```rust
66<View> {
67 width: Fill
68 height: Fill
69 align: { x: 0.5, y: 0.5 }
70
71 <Label> { text: "Centered" }
72}
73```
74
75### 3. Horizontal Row Layout
76
77```rust
78<View> {
79 width: Fill
80 height: Fit
81 flow: Right
82 spacing: 10.0
83 align: { y: 0.5 } // Vertically center items
84
85 <Button> { text: "Left" }
86 <View> { width: Fill } // Spacer
87 <Button> { text: "Right" }
88}
89```
90
91### 4. Fixed + Flexible Layout
92
93```rust
94<View> {
95 width: Fill
96 height: Fill
97 flow: Down
98
99 // Fixed header
100 <View> {
101 width: Fill
102 height: 60.0
103 }
104
105 // Flexible content
106 <View> {
107 width: Fill
108 height: Fill // Takes remaining space
109 }
110}
111```
112
113## Layout Properties Reference
114
115| Property | Type | Description |
116|----------|------|-------------|
117| `width` | Size | Width of element |
118| `height` | Size | Height of element |
119| `padding` | Padding | Inner spacing |
120| `margin` | Margin | Outer spacing |
121| `flow` | Flow | Child layout direction |
122| `spacing` | f64 | Gap between children |
123| `align` | Align | Child alignment |
124| `clip_x` | bool | Clip horizontal overflow |
125| `clip_y` | bool | Clip vertical overflow |
126
127## Size Values
128
129| Value | Description |
130|-------|-------------|
131| `Fit` | Size to fit content |
132| `Fill` | Fill available space |
133| `100.0` | Fixed size in pixels |
134| `Fixed(100.0)` | Explicit fixed size |
135
136## Flow Directions
137
138| Value | Description |
139|-------|-------------|
140| `Down` | Top to bottom (column) |
141| `Right` | Left to right (row) |
142| `Overlay` | Stack on top |
143
144## Align Values
145
146| Value | Position |
147|-------|----------|
148| `{ x: 0.0, y: 0.0 }` | Top-left |
149| `{ x: 0.5, y: 0.0 }` | Top-center |
150| `{ x: 1.0, y: 0.0 }` | Top-right |
151| `{ x: 0.0, y: 0.5 }` | Middle-left |
152| `{ x: 0.5, y: 0.5 }` | Center |
153| `{ x: 1.0, y: 0.5 }` | Middle-right |
154| `{ x: 0.0, y: 1.0 }` | Bottom-left |
155| `{ x: 0.5, y: 1.0 }` | Bottom-center |
156| `{ x: 1.0, y: 1.0 }` | Bottom-right |
157
158## Box Model
159
160```
161+---------------------------+
162| margin |
163| +---------------------+ |
164| | padding | |
165| | +---------------+ | |
166| | | content | | |
167| | +---------------+ | |
168| +---------------------+ |
169+---------------------------+
170```
171
172## When Writing Code
173
1741. Use `Fill` for flexible containers, `Fit` for content-sized elements
1752. Set `flow: Down` for vertical, `flow: Right` for horizontal
1763. Use empty `<View> { width: Fill }` as spacer in row layouts
1774. Always set explicit dimensions on fixed-size elements
1785. Use `align` to position children within container
179
180## When Answering Questions
181
1821. Makepad uses a "turtle" layout model - elements laid out sequentially
1832. `Fill` takes all available space, `Fit` shrinks to content
1843. Unlike CSS flexbox, there's no flex-grow/shrink - use Fill/Fit
1854. Alignment applies to children, not the element itself
186
187## Limitations
188- Use this skill only when the task clearly matches the scope described above.
189- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
190- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.