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
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
1---2name: makepad-layout3description: 'CRITICAL: Use for Makepad layout system. Triggers on:45 makepad layout, makepad width, makepad height, makepad flex,67 makepad padding, makepad margin, makepad flow, makepad align,89 Fit, Fill, Size, Walk, "how to center in makepad", makepad 布局, makepad 宽度, makepad10 对齐, makepad 居中'11risk: safe12source: community13license: MIT14metadata:15 source: https://skillmd.com/skills/jantoniofc/makepad-layout16---1718# Makepad Layout Skill1920> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1921>22> Check for updates: https://crates.io/crates/makepad-widgets2324You are an expert at Makepad layout system. Help users by:25- **Writing code**: Generate layout code following the patterns below26- **Answering questions**: Explain layout concepts, sizing, flow directions2728## When to Use29- You need to size, align, or position widgets in a Makepad UI.30- The task involves `Walk`, `Align`, `Fit`, `Fill`, padding, spacing, or container flow configuration.31- You want Makepad-specific layout solutions for centering, responsiveness, or composition.3233## Documentation3435Refer to the local files for detailed documentation:36- `./references/layout-system.md` - Complete layout reference37- `./references/core-types.md` - Walk, Align, Margin, Padding types3839## IMPORTANT: Documentation Completeness Check4041**Before answering questions, Claude MUST:**42431. Read the relevant reference file(s) listed above442. If file read fails or file is empty:45 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"46 - Still answer based on SKILL.md patterns + built-in knowledge473. If reference file exists, incorporate its content into the answer4849## Key Patterns5051### 1. Basic Layout Container5253```rust54<View> {55 width: Fill56 height: Fill57 flow: Down58 padding: 16.059 spacing: 8.06061 <Label> { text: "Item 1" }62 <Label> { text: "Item 2" }63}64```6566### 2. Centering Content6768```rust69<View> {70 width: Fill71 height: Fill72 align: { x: 0.5, y: 0.5 }7374 <Label> { text: "Centered" }75}76```7778### 3. Horizontal Row Layout7980```rust81<View> {82 width: Fill83 height: Fit84 flow: Right85 spacing: 10.086 align: { y: 0.5 } // Vertically center items8788 <Button> { text: "Left" }89 <View> { width: Fill } // Spacer90 <Button> { text: "Right" }91}92```9394### 4. Fixed + Flexible Layout9596```rust97<View> {98 width: Fill99 height: Fill100 flow: Down101102 // Fixed header103 <View> {104 width: Fill105 height: 60.0106 }107108 // Flexible content109 <View> {110 width: Fill111 height: Fill // Takes remaining space112 }113}114```115116## Layout Properties Reference117118| Property | Type | Description |119|----------|------|-------------|120| `width` | Size | Width of element |121| `height` | Size | Height of element |122| `padding` | Padding | Inner spacing |123| `margin` | Margin | Outer spacing |124| `flow` | Flow | Child layout direction |125| `spacing` | f64 | Gap between children |126| `align` | Align | Child alignment |127| `clip_x` | bool | Clip horizontal overflow |128| `clip_y` | bool | Clip vertical overflow |129130## Size Values131132| Value | Description |133|-------|-------------|134| `Fit` | Size to fit content |135| `Fill` | Fill available space |136| `100.0` | Fixed size in pixels |137| `Fixed(100.0)` | Explicit fixed size |138139## Flow Directions140141| Value | Description |142|-------|-------------|143| `Down` | Top to bottom (column) |144| `Right` | Left to right (row) |145| `Overlay` | Stack on top |146147## Align Values148149| Value | Position |150|-------|----------|151| `{ x: 0.0, y: 0.0 }` | Top-left |152| `{ x: 0.5, y: 0.0 }` | Top-center |153| `{ x: 1.0, y: 0.0 }` | Top-right |154| `{ x: 0.0, y: 0.5 }` | Middle-left |155| `{ x: 0.5, y: 0.5 }` | Center |156| `{ x: 1.0, y: 0.5 }` | Middle-right |157| `{ x: 0.0, y: 1.0 }` | Bottom-left |158| `{ x: 0.5, y: 1.0 }` | Bottom-center |159| `{ x: 1.0, y: 1.0 }` | Bottom-right |160161## Box Model162163```164+---------------------------+165| margin |166| +---------------------+ |167| | padding | |168| | +---------------+ | |169| | | content | | |170| | +---------------+ | |171| +---------------------+ |172+---------------------------+173```174175## When Writing Code1761771. Use `Fill` for flexible containers, `Fit` for content-sized elements1782. Set `flow: Down` for vertical, `flow: Right` for horizontal1793. Use empty `<View> { width: Fill }` as spacer in row layouts1804. Always set explicit dimensions on fixed-size elements1815. Use `align` to position children within container182183## When Answering Questions1841851. Makepad uses a "turtle" layout model - elements laid out sequentially1862. `Fill` takes all available space, `Fit` shrinks to content1873. Unlike CSS flexbox, there's no flex-grow/shrink - use Fill/Fit1884. Alignment applies to children, not the element itself189190## When to Use191This skill is applicable to execute the workflow or actions described in the overview.