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
Cursor
text
Cursor selects the system pointer shown while hovering a component.go
type Cursor uint8Related example · Source style.go:179
CursorAuto
text
CursorAuto uses the component default: text for editors, pointer for Button,
and the default arrow for other controls. Decorative children follow the
enclosing control unless they explicitly select a cursor.go
const (
// CursorAuto uses the component default: text for editors, pointer for Button,
// and the default arrow for other controls. Decorative children follow the
// enclosing control unless they explicitly select a cursor.
CursorAuto Cursor = iota
// CursorDefault selects the default arrow.
CursorDefault
// CursorText selects the text I-beam.
CursorText
// CursorPointer selects the pointing hand used for clickable buttons.
CursorPointer
)Related example · Source style.go:185
CursorDefault
text
CursorDefault selects the default arrow.See the corresponding constant block on this page for types and values.
Related example · Source style.go:187
CursorText
text
CursorText selects the text I-beam.See the corresponding constant block on this page for types and values.
Related example · Source style.go:189
CursorPointer
text
CursorPointer selects the pointing hand used for clickable buttons.See the corresponding constant block on this page for types and values.
Related example · Source style.go:191
Style
text
Style contains the supported layout, paint, typography, and cursor 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
// Cursor affects hover appearance only; it adds no focus or activation behavior.
Cursor Cursor
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:198
Visibility
text
Visibility controls whether a node contributes display items.go
type Visibility uint8Related example · Source style.go:230
Visible
go
const (
Visible Visibility = iota
Hidden
)Related example · Source style.go:233
Hidden
See the corresponding constant block on this page for types and values.
Related example · Source style.go:234
PointerBehavior
text
PointerBehavior controls pointer participation for a view subtree.go
type PointerBehavior uint8Related example · Source style.go:238
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:241
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:244
BorderPattern
text
BorderPattern selects how a border is painted. The zero value is solid.go
type BorderPattern uint8Related example · Source style.go:248
BorderSolid
go
const (
BorderSolid BorderPattern = iota
BorderDashed
)Related example · Source style.go:251
BorderDashed
See the corresponding constant block on this page for types and values.
Related example · Source style.go:252
BorderSides
text
BorderSides selects edges. Zero means all edges, not an absent border.go
type BorderSides uint8Related example · Source style.go:256
BorderTop
go
const (
BorderTop BorderSides = 1 << iota
BorderRight
BorderBottom
BorderLeft
BorderAll = BorderTop | BorderRight | BorderBottom | BorderLeft
)Related example · Source style.go:259
BorderRight
See the corresponding constant block on this page for types and values.
Related example · Source style.go:260
BorderBottom
See the corresponding constant block on this page for types and values.
Related example · Source style.go:261
BorderLeft
See the corresponding constant block on this page for types and values.
Related example · Source style.go:262
BorderAll
See the corresponding constant block on this page for types and values.
Related example · Source style.go:263
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:268
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:280
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:283
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:289
FontWeight
text
FontWeight selects the nearest registered face weight in a family.go
type FontWeight uint16Related example · Source style.go:296
WeightRegular
go
const (
WeightRegular FontWeight = 400
WeightMedium FontWeight = 500
WeightBold FontWeight = 700
)Related example · Source style.go:299
WeightMedium
See the corresponding constant block on this page for types and values.
Related example · Source style.go:300
WeightBold
See the corresponding constant block on this page for types and values.
Related example · Source style.go:301
FontSlant
text
FontSlant selects a registered normal or italic face.go
type FontSlant uint8Related example · Source style.go:305
SlantNormal
go
const (
SlantNormal FontSlant = iota
SlantItalic
)Related example · Source style.go:308
SlantItalic
See the corresponding constant block on this page for types and values.
Related example · Source style.go:309
TextAlign
text
TextAlign is horizontal alignment within a Text node's content box.go
type TextAlign uint8Related example · Source style.go:313
TextStart
go
const (
TextStart TextAlign = iota
TextCenter
TextEnd
)Related example · Source style.go:316
TextCenter
See the corresponding constant block on this page for types and values.
Related example · Source style.go:317
TextEnd
See the corresponding constant block on this page for types and values.
Related example · Source style.go:318
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:327
ComponentToken
text
ComponentToken names a component-level theme entry.go
type ComponentToken stringRelated example · Source style.go:338
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:341
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:348
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:355
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:366
ComponentTheme
text
ComponentTheme supplies semantic-token-backed defaults for one component.go
type ComponentTheme struct {
Base StylePatch
States StateStyles
}Related example · Source style.go:376
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:383
Direction
text
Direction selects Box's main axis. Vertical is the zero value.go
type Direction uint8Related example · Source style.go:402
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:406
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:408
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:413