Quick Start

This document will describe how to use GenUI Builtin Components with GenUI projects. We will provide easy-to-understand usage documentation for each component.

TIP

You may not understand the writing of the data types used in it, please refer to: Data

In this document, we will only introduce the label and button components symbolically. If you want to learn more components, please refer to: Components

label

The label component is a customizable label widget with animation and event handling capabilities. It allows hovering, focusing, and text styling through various properties, animations, and events.

Example

1<label text="'Hello World'" font_size="16.0" color="#FFF"> </label>

Properties

NameDescriptionType
themeThemeThemes
colorColorMakepadColor
stroke_hover_colorFont color when hoveringMakepadColor
stroke_focus_colorFont color when getting focusMakepadColor
font_sizeFont sizeF64
cursorMouse cursorMouseCursor
line_spacingLine spacingF64
height_factorHeight factorF64
wrapText wrapping methodTextWrap
font_familyFont typeLiveDependency
visibleVisible or notbool
heightheightSize
widthwidthSize
marginmarginMargin
paddingpaddingPadding
alignalignmentAlign
texttext contentString
animation_keywhether to allow animationbool
event_keywhether to allow eventsbool
grabKey_focuswhether to capture key focusbool

Event callback

NameDescriptionParameters
hover_inmouse enter eventGLabelHoverParam
hover_outmouse leave eventGLabelHoverParam
focusget focus eventGLabelFocusParam
focus_lostFocus lost eventGLabelFocusLostParam

button

A customizable button designed for interactive UI elements. It supports hover, focus, and click animations, and has various configurable appearance properties, including background color, shadow, and border style.

Example

Basic Usage

1<button>
2  <label as_prop="slot" text="'Hello'"></label>
3</button>

Define inner

1<button>
2  <view as_prop="slot">
3    <label text="'Hello'"></label>
4    <label text="'World'"></label>
5  </view>
6</button>

Properties

NameDescriptionType
themeThemeThemes
background_colorBackground colorMakepadColor
background_visibleIs the background visiblebool
hover_colorHover colorMakepadColor
focus_colorFocus colorMakepadColor
shadow_colorShadow colorMakepadColor
spread_radiusShadow spread radiusF32
blur_radiusShadow blur radiusF32
shadow_offsetShadow offsetVec2
border_colorBorder colorMakepadColor
border_widthBorder widthF32
border_radiusBorder radiusF32
cursorMouse pointerMouseCursor
visibleVisible or notbool
grab_key_focusGrab keyboard focus or notbool
animation_keyAnimation keybool
event_keyEvent keybool
abs_posAbsolute positionDVec2
marginMarginMargin
widthWidthSize
heightHeightSize
scrollScroll offsetDVec2
clip_xClip X axis or notbool
clip_yClip Y axis or notbool
paddingPaddingPadding
alignAlignmentAlign
flowFlowFlow
spacingSpacingF64

Event callback

NameDescriptionParameters
hover_inMouse enter eventGButtonHoverParam
hover_outMouse leave eventGButtonHoverParam
clickedClick eventGButtonClickedParam
focusGet focus eventGButtonFocusParam
focus_lostLose focus eventGButtonFocusLostParam