English
Layout, style, and theme types: Full declarations
These declarations are extracted from the Go AST, retaining English source contracts and field comments while hiding private fields. struct {} represents an opaque implementation, not permission to use a zero value instead of its constructor. Constant blocks retain iota context.
Length
text
Length is an opaque automatic, logical-pixel, or percentage length. Its zero
value means automatic sizing; use Px or Percent for an explicit value.go
type Length struct {
}Related example · Source style.go:13
Px
text
Px creates a logical-pixel length.go
func Px(value float32) LengthRelated example · Source style.go:19
Percent
text
Percent creates a percentage length in the range 0..100.go
func Percent(value float32) LengthRelated example · Source style.go:22
Fill
text
Fill is the common full-available-axis length. It is equivalent to
Percent(100) and remains subject to the parent's definite-size rules.go
func Fill() LengthRelated example · Source style.go:26
MetricToken
text
MetricToken names a theme metric.go
type MetricToken stringRelated example · Source style.go:29
ColorToken
text
ColorToken names a theme color.go
type ColorToken stringRelated example · Source style.go:32
MetricValue
text
MetricValue is either a literal logical-unit metric or a theme token.go
type MetricValue struct {
}Related example · Source style.go:35
Metric
text
Metric creates a literal metric.go
func Metric(value float32) MetricValueRelated example · Source style.go:43
NoShrink
text
NoShrink explicitly disables flex shrinking. It is equivalent to Some(0)
and is distinct from an unset Shrink, whose default is one.go
func NoShrink() Option[float32]Related example · Source style.go:47
Padding
text
Padding applies one literal logical-unit metric to every edge. The returned
metrics are explicitly set, including when value is zero.go
func Padding(value float32) EdgeValuesRelated example · Source style.go:51
PaddingXY
text
PaddingXY applies literal logical-unit metrics to the horizontal and vertical
edges. The returned metrics are explicitly set, including zero values.go
func PaddingXY(horizontal, vertical float32) EdgeValuesRelated example · Source style.go:55
Margin
text
Margin applies one literal logical-unit metric to every edge, like Padding.
The returned metrics are explicitly set, including when value is zero.go
func Margin(value float32) EdgeValuesRelated example · Source style.go:64
MarginXY
text
MarginXY applies literal logical-unit metrics to the horizontal and vertical
edges, like PaddingXY. The returned metrics are explicitly set, including zero values.go
func MarginXY(horizontal, vertical float32) EdgeValuesRelated example · Source style.go:68
Round
text
Round applies one literal logical-unit radius to every corner. The returned
metrics are explicitly set, including when value is zero.go
func Round(value float32) CornerValuesRelated example · Source style.go:72
TokenMetric
text
TokenMetric creates a token-backed metric.go
func TokenMetric(token MetricToken) MetricValueRelated example · Source style.go:75
ColorValue
text
ColorValue is either a literal color or a theme token.go
type ColorValue struct {
}Related example · Source style.go:80
ColorRGBA
text
ColorRGBA creates an explicitly set literal paint color from RGBA channels,
including transparent zero. Use RGBA for raw RGBAColor data instead.go
func ColorRGBA(r, g, b, a uint8) ColorValueRelated example · Source style.go:89
LiteralColor
text
LiteralColor wraps existing raw RGBA data as a literal paint color.
Use ColorRGBA when supplying channels directly.go
func LiteralColor(value RGBAColor) ColorValueRelated example · Source style.go:93
TokenColor
text
TokenColor creates a token-backed paint color.go
func TokenColor(token ColorToken) ColorValueRelated example · Source style.go:96
EdgeValues
text
EdgeValues contains metrics in top, right, bottom, left order. Its zero-value
fields are unset.go
type EdgeValues struct{ Top, Right, Bottom, Left MetricValue }Related example · Source style.go:102
Edges
text
Edges creates explicit logical-unit edges in top, right, bottom, left order.go
func Edges(top, right, bottom, left float32) EdgeValuesRelated example · Source style.go:105
UniformEdges
text
UniformEdges applies one metric to every edge.go
func UniformEdges(value MetricValue) EdgeValuesRelated example · Source style.go:115
CornerValues
text
CornerValues contains radii in top-left, top-right, bottom-right, bottom-left order.
Its zero-value fields are unset.go
type CornerValues struct{ TopLeft, TopRight, BottomRight, BottomLeft MetricValue }Related example · Source style.go:121
Corners
text
Corners creates explicit logical-unit radii in top-left, top-right,
bottom-right, bottom-left order.go
func Corners(topLeft, topRight, bottomRight, bottomLeft float32) CornerValuesRelated example · Source style.go:125
UniformCorners
text
UniformCorners applies one radius to every corner.go
func UniformCorners(value MetricValue) CornerValuesRelated example · Source style.go:135
Position
text
Position controls normal-flow versus absolute layout.go
type Position uint8Related example · Source style.go:140
PositionFlow
go
const (
PositionFlow Position = iota
PositionAbsolute
)Related example · Source style.go:143
PositionAbsolute
See the corresponding constant block on this page for types and values.
Related example · Source style.go:144
Insets
text
Insets contains absolute-position insets.go
type Insets struct{ Top, Right, Bottom, Left Length }Related example · Source style.go:148
Overflow
text
Overflow controls container clipping.go
type Overflow uint8Related example · Source style.go:151
OverflowVisible
go
const (
OverflowVisible Overflow = iota
OverflowClip
)Related example · Source style.go:154
OverflowClip
See the corresponding constant block on this page for types and values.
Related example · Source style.go:155
Align
text
Align controls cross-axis alignment.go
type Align uint8Related example · Source style.go:159
AlignStart
go
const (
AlignStart Align = iota
AlignCenter
AlignEnd
AlignStretch
)Related example · Source style.go:162
AlignCenter
See the corresponding constant block on this page for types and values.
Related example · Source style.go:163
AlignEnd
See the corresponding constant block on this page for types and values.
Related example · Source style.go:164
AlignStretch
See the corresponding constant block on this page for types and values.
Related example · Source style.go:165
Justify
text
Justify controls main-axis alignment.go
type Justify uint8Related example · Source style.go:169
JustifyStart
go
const (
JustifyStart Justify = iota
JustifyCenter
JustifyEnd
JustifySpaceBetween
)Related example · Source style.go:172
JustifyCenter
See the corresponding constant block on this page for types and values.
Related example · Source style.go:173
JustifyEnd
See the corresponding constant block on this page for types and values.
Related example · Source style.go:174
JustifySpaceBetween
See the corresponding constant block on this page for types and values.
Related example · Source style.go:175
Style
text
Style contains the supported layout, paint, and typography controls. Box
is always single-line; there is intentionally no wrap or order
property. The zero value is safe and selects intrinsic sizing and theme
defaults.go
type Style struct {
Width, Height Length
MinWidth, MinHeight Length
MaxWidth, MaxHeight Length
Margin, Padding EdgeValues
Position Position
Insets Insets
Grow float32
Shrink Option[float32]
Basis Length
AlignSelf Option[Align]
ZIndex int
Overflow Overflow
Background ColorValue
Border Border
Radius CornerValues
// Shadow is an explicitly requested list of outer shadows. A nil value
// leaves a theme/state value unchanged; a non-nil empty slice removes it.
Shadow []Shadow
Opacity Option[float32]
Visibility Visibility
Text TextStyle
// Force is applied after component and interaction-state styles. It is for
// deliberate paint overrides such as suppressing a focus ring; ordinary
// base appearance belongs in the fields above so Hover/Pressed/Focus remain
// visible. Force cannot affect layout.
Force StylePatch
}Related example · Source style.go:182
Visibility
text
Visibility controls whether a node contributes display items.go
type Visibility uint8Related example · Source style.go:212
Visible
go
const (
Visible Visibility = iota
Hidden
)Related example · Source style.go:215
Hidden
See the corresponding constant block on this page for types and values.
Related example · Source style.go:216
PointerBehavior
text
PointerBehavior controls pointer participation for a view subtree.go
type PointerBehavior uint8Related example · Source style.go:220
PointerAuto
go
const (
PointerAuto PointerBehavior = iota
// PointerNone excludes the view and all descendants. It is intended for
// decorative overlays that must not intercept content below them.
PointerNone
)Related example · Source style.go:223
PointerNone
text
PointerNone excludes the view and all descendants. It is intended for
decorative overlays that must not intercept content below them.See the corresponding constant block on this page for types and values.
Related example · Source style.go:226
BorderPattern
text
BorderPattern selects how a border is painted. The zero value is solid.go
type BorderPattern uint8Related example · Source style.go:230
BorderSolid
go
const (
BorderSolid BorderPattern = iota
BorderDashed
)Related example · Source style.go:233
BorderDashed
See the corresponding constant block on this page for types and values.
Related example · Source style.go:234
BorderSides
text
BorderSides selects edges. Zero means all edges, not an absent border.go
type BorderSides uint8Related example · Source style.go:238
BorderTop
go
const (
BorderTop BorderSides = 1 << iota
BorderRight
BorderBottom
BorderLeft
BorderAll = BorderTop | BorderRight | BorderBottom | BorderLeft
)Related example · Source style.go:241
BorderRight
See the corresponding constant block on this page for types and values.
Related example · Source style.go:242
BorderBottom
See the corresponding constant block on this page for types and values.
Related example · Source style.go:243
BorderLeft
See the corresponding constant block on this page for types and values.
Related example · Source style.go:244
BorderAll
See the corresponding constant block on this page for types and values.
Related example · Source style.go:245
Border
text
Border is a paint-only border drawn inside a view's layout bounds.
Each side owns the nearest half of its two adjacent corner arcs.go
type Border struct {
Width MetricValue
Color ColorValue
Pattern BorderPattern
// Sides defaults to all edges. In Style, a Width/Color assignment resets
// Sides too; otherwise nonzero Sides changes only edge selection.
// StylePatch.Border replaces the complete Border.
Sides BorderSides
}Related example · Source style.go:250
NoBorder
text
NoBorder explicitly clears the border width. In ordinary Style, later state
patches may restore a border; Style.Force is applied after those patches.go
func NoBorder() BorderRelated example · Source style.go:262
Stroke
text
Stroke creates a solid border with a literal logical-unit width.go
func Stroke(width float32, color ColorValue) BorderRelated example · Source style.go:265
Shadow
text
Shadow is an outer paint-only shadow. MVP shadows support finite,
non-negative blur/spread and are rendered by a bounded approximation.go
type Shadow struct {
OffsetX, OffsetY MetricValue
Blur, Spread MetricValue
Color ColorValue
}Related example · Source style.go:271
FontWeight
text
FontWeight selects the nearest registered face weight in a family.go
type FontWeight uint16Related example · Source style.go:278
WeightRegular
go
const (
WeightRegular FontWeight = 400
WeightMedium FontWeight = 500
WeightBold FontWeight = 700
)Related example · Source style.go:281
WeightMedium
See the corresponding constant block on this page for types and values.
Related example · Source style.go:282
WeightBold
See the corresponding constant block on this page for types and values.
Related example · Source style.go:283
FontSlant
text
FontSlant selects a registered normal or italic face.go
type FontSlant uint8Related example · Source style.go:287
SlantNormal
go
const (
SlantNormal FontSlant = iota
SlantItalic
)Related example · Source style.go:290
SlantItalic
See the corresponding constant block on this page for types and values.
Related example · Source style.go:291
TextAlign
text
TextAlign is horizontal alignment within a Text node's content box.go
type TextAlign uint8Related example · Source style.go:295
TextStart
go
const (
TextStart TextAlign = iota
TextCenter
TextEnd
)Related example · Source style.go:298
TextCenter
See the corresponding constant block on this page for types and values.
Related example · Source style.go:299
TextEnd
See the corresponding constant block on this page for types and values.
Related example · Source style.go:300
TextStyle
text
TextStyle contains the simple-LTR/CJK MVP text inputs. Families are tried in
order before the App default and built-in Latin fallback. Size is a font
size in logical units; zero uses the current theme's default. LineHeight is
a logical-unit line height; zero uses the current theme's default.
Arabic/Indic shaping, bidi/RTL, color emoji, and vertical text are not
supported by this API.go
type TextStyle struct {
Families []FontFamily
Size float32
LineHeight float32
Weight FontWeight
Slant FontSlant
Color ColorValue
Align TextAlign
}Related example · Source style.go:309
ComponentToken
text
ComponentToken names a component-level theme entry.go
type ComponentToken stringRelated example · Source style.go:320
PrimitiveTokens
text
PrimitiveTokens are the literal foundation of a theme.go
type PrimitiveTokens struct {
Colors map[ColorToken]RGBAColor
Metrics map[MetricToken]float32
}Related example · Source style.go:323
SemanticTokens
text
SemanticTokens map product meaning onto primitive or earlier semantic
tokens. A literal ColorValue/MetricValue is also accepted.go
type SemanticTokens struct {
Colors map[ColorToken]ColorValue
Metrics map[MetricToken]MetricValue
}Related example · Source style.go:330
StylePatch
text
StylePatch is an explicitly optional paint-only override. State styles are
intentionally paint-only in MVP, so interaction never moves layout.go
type StylePatch struct {
Background Option[ColorValue]
Border Option[Border]
Radius Option[CornerValues]
Shadow Option[[]Shadow]
Opacity Option[float32]
Visibility Option[Visibility]
TextColor Option[ColorValue]
}Related example · Source style.go:337
StateStyles
text
StateStyles contains the deterministic MVP visual-state cascade.go
type StateStyles struct {
Default StylePatch
Hover StylePatch
Focus StylePatch
Disabled StylePatch
Pressed StylePatch
Checked StylePatch
}Related example · Source style.go:348
ComponentTheme
text
ComponentTheme supplies semantic-token-backed defaults for one component.go
type ComponentTheme struct {
Base StylePatch
States StateStyles
}Related example · Source style.go:358
Theme
text
Theme is the public, type-safe Primitive -> Semantic -> Component token
structure. SetTheme validates and copies every map and slice atomically.go
type Theme struct {
Primitive PrimitiveTokens
Semantic SemanticTokens
Components map[ComponentToken]ComponentTheme
}Related example · Source style.go:365
Direction
text
Direction selects Box's main axis. Vertical is the zero value.go
type Direction uint8Related example · Source style.go:384
Vertical
text
Vertical lays out Box children from top to bottom and is the zero value.go
const (
// Vertical lays out Box children from top to bottom and is the zero value.
Vertical Direction = iota
// Horizontal lays out Box children from left to right.
Horizontal
)Related example · Source style.go:388
Horizontal
text
Horizontal lays out Box children from left to right.See the corresponding constant block on this page for types and values.
Related example · Source style.go:390
BoxProps
text
BoxProps configures a Box. Gap is a fixed logical-unit spacing; zero means
no spacing between children.go
type BoxProps struct {
Key string
Style Style
Token ComponentToken
States StateStyles
Pointer PointerBehavior
Direction Direction
Gap float32
Justify Justify
Align Align
}Related example · Source style.go:395