Back to list
ZhangHanDong

makepad-layout

by ZhangHanDong

Build App with Makepad and AI skills

677🍴 76📅 Jan 23, 2026

SKILL.md


name: makepad-layout description: | CRITICAL: Use for Makepad layout system. Triggers on: makepad layout, makepad width, makepad height, makepad flex, makepad padding, makepad margin, makepad flow, makepad align, Fit, Fill, Size, Walk, "how to center in makepad", makepad 布局, makepad 宽度, makepad 对齐, makepad 居中

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

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:

  1. Read the relevant reference file(s) listed above
  2. 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
  3. 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

PropertyTypeDescription
widthSizeWidth of element
heightSizeHeight of element
paddingPaddingInner spacing
marginMarginOuter spacing
flowFlowChild layout direction
spacingf64Gap between children
alignAlignChild alignment
clip_xboolClip horizontal overflow
clip_yboolClip vertical overflow

Size Values

ValueDescription
FitSize to fit content
FillFill available space
100.0Fixed size in pixels
Fixed(100.0)Explicit fixed size

Flow Directions

ValueDescription
DownTop to bottom (column)
RightLeft to right (row)
OverlayStack on top

Align Values

ValuePosition
{ 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

  1. Use Fill for flexible containers, Fit for content-sized elements
  2. Set flow: Down for vertical, flow: Right for horizontal
  3. Use empty <View> { width: Fill } as spacer in row layouts
  4. Always set explicit dimensions on fixed-size elements
  5. Use align to position children within container

When Answering Questions

  1. Makepad uses a "turtle" layout model - elements laid out sequentially
  2. Fill takes all available space, Fit shrinks to content
  3. Unlike CSS flexbox, there's no flex-grow/shrink - use Fill/Fit
  4. Alignment applies to children, not the element itself

Score

Total Score

80/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 500以上

+10
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon