Complete list of all fields supported by ui!{}, with their slim aliases and value patterns.
This page documents every field you can use inside ui!{}. Each field maps to one or more Bevy components. Use full field names in CSS-like mode (ui!((...))) and slim aliases in slim mode (ui!(...)).
The Values column describes what you can write after the field name:
Val — any numeric value with units (px, %, vh, vw, vmin, vmax)
#hex — any hex color (#f00, #ff0000, #ff000080)
edge selection — CSS-like multi-value notation (see Edge Selection )
corner selection — CSS-like corner notation (see Corner Selection )
track list — CSS Grid track syntax (see Grid Track Syntax )
Field Slim Alias Values
position_type(none) absolute, relative
position(none) absolute, relative
absoluteabsolute(shortcut — no value needed)
relativerelative(shortcut — no value needed)
Field Slim Alias Values
hidden(none) (shortcut — no value needed)
visible(none) (shortcut — no value needed)
inherit(none) (shortcut — no value needed)
Warning
Transform affects UI layout differently than you might expect. Scale and rotation are applied after layout, not before. This means a rotated element won’t affect its siblings’ layout.
Field Slim Alias Values
scale(none) x or x y
rotation(none) number (radians) or numberdeg
Field Slim Alias Values
leftlVal (px, %, vh, vw, vmin, vmax)
rightrVal
toptVal
bottombVal
x(none) Val (sets left + right)
y(none) Val (sets top + bottom)
xy(none) Val (sets left, right, top, bottom)
z_indexz, zindexnumber
z_globalzgnumber
Field Slim Alias Values
widthwVal
heighthVal
size(none) width height
min_widthmin_wVal
min_heightmin_hVal
max_widthmax_wVal
max_heightmax_hVal
aspect_ratio(none) f32
flex_basis(none) Val
Field Slim Alias Values
marginm1 value (all edges) or edge selection
margin_topmtVal
margin_bottommbVal
margin_leftmlVal
margin_rightmrVal
margin_xmxVal (sets left + right)
margin_ymyVal (sets top + bottom)
Field Slim Alias Values
paddingp1 value (all edges) or edge selection
padding_topptVal
padding_bottompbVal
padding_leftplVal
padding_rightprVal
padding_xpxVal (sets left + right)
padding_ypyVal (sets top + bottom)
Field Slim Alias Values
background_colorbackground, bg#hex, #rgba, or CSS color name
box_shadowshadowx y blur spread color or 1-4 vals + color
borderborderedge selection (see below)
border_color(none) #hex or CSS color name
outline(none) width offset color
border_radiusround, roundedcorner selection (see below)
border: 5px; // all 4 edges
border: 5px 2px; // vertical, horizontal
border: 5px 2px 8px; // top, horizontal, bottom
border: 5px 2px 4px 1px; // top, right, bottom, left
border_radius: 5px; // all 4 corners
border_radius: 5px 0px; // top-left/right, bottom-left/right
border_radius: 5px 2px 8px; // top-left, top-right, bottom
border_radius: 5px 2px 4px 1px; // clockwise: TL, TR, BR, BL
Field Slim Alias Values
font_colorcolor#hex, #rgba, or CSS color name
font_sizetext_sizef32
text(none) f32 (font size), or enum variants: Left, Center, Right, Justified (justify), or WordBoundary, AnyCharacter, WordOrCharacter, NoWrap (line break; defaults to WordBoundary)
justify_text(none) left, center, right, justified (converted to PascalCase: JustifyText::* or Justify::* depending on version; defaults to left)
line_break(none) word_boundary, any_character, word_or_character, no_wrap (converted to LineBreak::*; defaults to word_boundary)
line_heightleadingf32 (relative to font)
text_shadow(none) x y color
Field Slim Alias Values
imageimg$var (variable), #hex (color), or flip_x/flip_y
image_colorimg_color#hex or CSS color name
Field Slim Alias Values
flex_directionflexrow, column, row_reverse, column_reverse (converted to FlexDirection::*)
flex_grow(none) f32
flex_shrink(none) f32
flex_wrap(none) no_wrap, wrap, wrap_reverse (converted to FlexWrap::*)
Field Slim Alias Values
grid_auto_flow(none) row, column, row_dense, column_dense (converted to GridAutoFlow::*)
grid_row(none) span n, start n, end n, or start n end n (note: 3+ value syntax has a known bug in the code)
grid_column(none) span n, start n, end n, or start n end n (note: 3+ value syntax has a known bug in the code)
grid_auto_rows(none) track list (e.g. 1px 3% 10fr min_content)
grid_auto_columns(none) track list
grid_template_rows(none) repetition:track list
grid_template_columns(none) repetition:track list
Field Slim Alias Values
display(none) flex, grid, block, none (converted to Display::*)
justify_items(none) default, start, end, center, baseline, stretch
align_items(none) default, start, end, center, baseline, stretch
justify_content(none) default, start, end, flex_start, flex_end, center, stretch, space_between, space_evenly, space_around
align_content(none) default, start, end, flex_start, flex_end, center, stretch, space_between, space_evenly, space_around
justify_self(none) auto, start, end, center, baseline, stretch
align_self(none) auto, start, end, center, baseline, stretch
row_gapgap_yVal
column_gapgap_xVal
gap(none) gap_x gap_y
overflow(none) visible, clip, hidden, scroll (converted to PascalCase: OverflowAxis::*; no value = Overflow::DEFAULT; or x y separately)
overflow_clip_margin(none) (no value = DEFAULT) , border_box, padding_box, content_box, or border_box 5 (visual_box + optional margin)
relative_cursor_positioncursor_pos, cursor_position(component only — no value)
focus_policyfocuspass, ignore, consume (default: pass)
scroll_positionscroll(no value = adds component) , x y (optional)
interaction(none) (component only — no value)