|
✓Works with OpenClaudeCheck 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
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
- Inform user: "本地文档不完整,建议运行
- 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
Fillfor flexible containers,Fitfor content-sized elements - Set
flow: Downfor vertical,flow: Rightfor horizontal - Use empty
<View> { width: Fill }as spacer in row layouts - Always set explicit dimensions on fixed-size elements
- Use
alignto position children within container
When Answering Questions
- Makepad uses a "turtle" layout model - elements laid out sequentially
Filltakes all available space,Fitshrinks to content- Unlike CSS flexbox, there's no flex-grow/shrink - use Fill/Fit
- Alignment applies to children, not the element itself
Related community Skills
Other Claude Code skills in the same category — free to download.
board-prep
/em -board-prep — Board Meeting Preparation
browserstack
>-
challenge
/em -challenge — Pre-Mortem Plan Analysis
code-to-prd
|
codebase-onboarding
Codebase Onboarding
competitor-alternatives
When the user wants to create competitor comparison or alternative pages for SEO and sales enablement. Also use when the user mentions 'alternative page,' 'vs page,' 'competitor comparison,' 'comparis
content-strategy
When the user wants to plan a content strategy, decide what content to create, or figure out what topics to cover. Also use when the user mentions \"content strategy,\" \"what should I write about,\"
contract-and-proposal-writer
Contract & Proposal Writer
Want a community skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.