Back to list
ZhangHanDong

makepad-widgets

by ZhangHanDong

Build App with Makepad and AI skills

677🍴 76📅 Jan 23, 2026

SKILL.md


name: makepad-widgets description: | CRITICAL: Use for Makepad widgets and UI components. Triggers on: makepad widget, makepad View, makepad Button, makepad Label, makepad Image, makepad TextInput, RoundedView, SolidView, ScrollView, "makepad component", makepad Markdown, makepad Html, TextFlow, rich text, 富文本, markdown渲染, makepad 组件, makepad 按钮, makepad 列表, makepad 视图, makepad 输入框

Makepad Widgets 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 widgets. Help users by:

  • Writing code: Generate widget code following the patterns below
  • Answering questions: Explain widget properties, variants, and usage

Documentation

Refer to the local files for detailed documentation:

  • ./references/widgets-core.md - Core widgets (View, Button, Label, etc.)
  • ./references/widgets-advanced.md - Helper and advanced widgets
  • ./references/widgets-richtext.md - Rich text widgets (Markdown, Html, TextFlow)

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. View (Basic Container)

<View> {
    width: Fill
    height: Fill
    flow: Down
    padding: 16.0
    show_bg: true
    draw_bg: { color: #1A1A1A }

    <Label> { text: "Content" }
}

2. Button

<Button> {
    text: "Click Me"
    draw_bg: {
        color: #0066CC
        color_hover: #0088FF
        border_radius: 4.0
    }
    draw_text: {
        color: #FFFFFF
        text_style: { font_size: 14.0 }
    }
}

3. Label with Styling

<Label> {
    width: Fit
    height: Fit
    text: "Hello World"
    draw_text: {
        color: #FFFFFF
        text_style: {
            font_size: 16.0
            line_spacing: 1.4
        }
    }
}

4. Image

<Image> {
    width: 200.0
    height: 150.0
    source: dep("crate://self/resources/photo.png")
    fit: Contain
}

5. TextInput

<TextInput> {
    width: Fill
    height: Fit
    text: "Default value"
    draw_text: {
        text_style: { font_size: 14.0 }
    }
}

Widget Traits (from source)

pub trait WidgetNode: LiveApply {
    fn find_widgets(&self, path: &[LiveId], cached: WidgetCache, results: &mut WidgetSet);
    fn walk(&mut self, cx: &mut Cx) -> Walk;
    fn area(&self) -> Area;
    fn redraw(&mut self, cx: &mut Cx);
}

pub trait Widget: WidgetNode {
    fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {}
    fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep;
    fn draw(&mut self, cx: &mut Cx2d, scope: &mut Scope) -> DrawStep;
    fn widget(&self, path: &[LiveId]) -> WidgetRef;
}

All Built-in Widgets (84 files in widgets/src/)

CategoryWidgets
BasicView, Label, Button, Icon, Image
InputTextInput, CheckBox, RadioButton, Slider, DropDown, ColorPicker
ContainerScrollBars, PortalList, FlatList, StackNavigation, Dock, Splitter
NavigationTabBar, Tab, FoldHeader, FoldButton, ExpandablePanel
OverlayModal, Tooltip, PopupMenu, PopupNotification
MediaVideo, RotatedImage, ImageBlend, MultiImage
LayoutAdaptiveView, SlidePanel, PageFlip, SlidesView
SpecialMarkdown, Html, TextFlow, WebView, KeyboardView
UtilityLoadingSpinner, DesktopButton, LinkLabel, ScrollShadow

Core Widgets Reference

WidgetPurposeKey Properties
ViewContainerflow, align, show_bg, draw_bg, optimize
ButtonClickabletext, draw_bg, draw_text, draw_icon
LabelText displaytext, draw_text
ImageImage displaysource, fit
TextInputText entrytext, draw_text, draw_cursor, draw_selection
CheckBoxToggletext, selected
RadioButtonSelectiontext, selected
SliderValue slidermin, max, step
DropDownSelect menulabels, selected
PortalListVirtual listEfficient scrolling for large lists
ModalDialogOverlay dialog boxes
TooltipHintHover tooltips

View Variants

VariantDescription
SolidViewSolid background color
RoundedViewRounded corners
RoundedAllViewIndividual corner control
RectViewRectangle with border/gradient
CircleViewCircle/ellipse shape
GradientXViewHorizontal gradient
GradientYViewVertical gradient
RoundedShadowViewRounded with shadow
ScrollXViewHorizontal scroll
ScrollYViewVertical scroll
ScrollXYViewBoth directions scroll
CachedViewTexture-cached

Button Variants

VariantDescription
ButtonFlatFlat style
ButtonFlatIconFlat with icon
ButtonFlatterNo background
ButtonGradientXHorizontal gradient
ButtonGradientYVertical gradient
ButtonIconStandard with icon

ImageFit Values

ValueDescription
StretchStretch to fill
ContainFit within, preserve ratio
CoverCover area, may crop
FillFill without ratio

When Writing Code

  1. Always set width and height on widgets
  2. Use show_bg: true to enable background rendering
  3. Access draw_bg, draw_text, draw_icon for shader uniforms
  4. Use dep("crate://self/...") for resource paths
  5. Choose appropriate View variant for visual needs

When Answering Questions

  1. Recommend UI Zoo example for widget exploration
  2. View is the base container - most visual widgets inherit from it
  3. Draw shaders (draw_bg, draw_text) control appearance
  4. All widgets support animation through animator property

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