Agent skill

makepad-layout

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 居中

Stars 731
Forks 83

Install this agent skill to your Project

npx add-skill https://github.com/ZhangHanDong/makepad-skills/tree/main/skills/makepad-layout

SKILL.md

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

rust
<View> {
    width: Fill
    height: Fill
    flow: Down
    padding: 16.0
    spacing: 8.0

    <Label> { text: "Item 1" }
    <Label> { text: "Item 2" }
}

2. Centering Content

rust
<View> {
    width: Fill
    height: Fill
    align: { x: 0.5, y: 0.5 }

    <Label> { text: "Centered" }
}

3. Horizontal Row Layout

rust
<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

rust
<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

  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

Expand your agent's capabilities with these related and highly-rated skills.

ZhangHanDong/makepad-skills

makepad-splash

CRITICAL: Use for Makepad Splash scripting language. Triggers on: splash language, makepad script, makepad scripting, script!, cx.eval, makepad dynamic, makepad AI, splash 语言, makepad 脚本

731 83
Explore
ZhangHanDong/makepad-skills

makepad-platform

CRITICAL: Use for Makepad cross-platform support. Triggers on: makepad platform, makepad os, makepad macos, makepad windows, makepad linux, makepad android, makepad ios, makepad web, makepad wasm, makepad metal, makepad d3d11, makepad opengl, makepad webgl, OsType, CxOs, makepad 跨平台, makepad 平台支持

731 83
Explore
ZhangHanDong/makepad-skills

robius-app-architecture

CRITICAL: Use for Robius app architecture patterns. Triggers on: Tokio, async, submit_async_request, 异步, 架构, SignalToUI, Cx::post_action, worker task, app structure, MatchEvent, handle_startup

731 83
Explore
ZhangHanDong/makepad-skills

robius-event-action

CRITICAL: Use for Robius event and action patterns. Triggers on: custom action, MatchEvent, post_action, cx.widget_action, handle_actions, DefaultNone, widget action, event handling, 事件处理, 自定义动作

731 83
Explore
ZhangHanDong/makepad-skills

robius-widget-patterns

CRITICAL: Use for Robius widget patterns. Triggers on: apply_over, TextOrImage, modal, 可复用, 模态, collapsible, drag drop, reusable widget, widget design, pageflip, 组件设计, 组件模式

731 83
Explore
ZhangHanDong/makepad-skills

makepad-reference

CRITICAL: Use for Makepad troubleshooting and reference. Triggers on: troubleshoot, error, debug, fix, problem, issue, no matching field, parse error, widget not found, UI not updating, code quality, refactor, responsive layout, adaptive, api docs, reference, documentation, 故障排除, 错误, 调试, 问题, 修复

731 83
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results