Tokens and sizing
Component scale, parent-space behavior, spacing, height, and radius tokens.
FreakUI separates a component's visual scale from the space it occupies. Use FComponentSize for the visual hierarchy, sizing modes for parent-space behavior, and semantic tokens for app-owned spacing and geometry.
Component scale
FComponentSize is a seven-step scale. A component size can change typography, padding, gaps, icons, radius, and control metrics without prescribing the component's width or height.
| Size | Body | Title | Label | Caption | Number | Icon | Control height |
|---|---|---|---|---|---|---|---|
.extraExtraSmall | .bodyXS | .title3XS | .labelXS | .captionXS | .numberXS | .icon3XS | .height2XS |
.extraSmall | .bodyS | .title2XS | .labelS | .captionS | .numberS | .icon2XS | .heightXS |
.small | .bodyM | .titleXS | .labelM | .captionM | .numberM | .iconXS | .heightS |
.medium | .bodyL | .titleS | .labelL | .captionL | .numberL | .iconS | .heightM |
.large | .bodyXL | .titleM | .labelXL | .captionXL | .numberXL | .iconM | .heightL |
.extraLarge | .body2XL | .titleL | .label2XL | .caption2XL | .number2XL | .iconL | .heightXL |
.extraExtraLarge | .body3XL | .titleXL | .label3XL | .caption3XL | .number3XL | .iconXL | .height2XL |
FButton(
size: .medium,
horizontalSizingMode: .fillContainer,
title: "Continue"
) {
continueFlow()
}
Parent-space sizing
FHorizontalSizingMode and FVerticalSizingMode provide .hugContents, .fillContainer, and .fixed(CGFloat). FContentAlignment aligns content inside a component when the component has extra horizontal space.
Use intrinsic sizing by default, fill when the parent proposes meaningful space, and fixed sizing only for deliberate product or platform geometry.
Spacing tokens
FSpacingScale selects the active density column. All values are points.
| Token | XS | S | M | L | XL |
|---|---|---|---|---|---|
.paddingNone | 0 | 0 | 0 | 0 | 0 |
.paddingFixed1 | 1 | 1 | 1 | 1 | 1 |
.paddingStandard | 16 | 16 | 16 | 16 | 16 |
.padding4XS | 0 | 2 | 4 | 6 | 8 |
.padding3XS | 2 | 4 | 6 | 8 | 10 |
.padding2XS | 4 | 6 | 8 | 10 | 12 |
.paddingXS | 6 | 8 | 10 | 12 | 14 |
.paddingS | 8 | 10 | 12 | 14 | 16 |
.paddingM | 10 | 12 | 14 | 16 | 18 |
.paddingL | 12 | 14 | 16 | 18 | 20 |
.paddingXL | 14 | 16 | 18 | 20 | 22 |
.padding2XL | 16 | 18 | 20 | 22 | 24 |
.padding3XL | 18 | 20 | 22 | 24 | 26 |
.padding4XL | 20 | 22 | 24 | 26 | 28 |
.padding5XL | 22 | 24 | 26 | 28 | 30 |
.paddingFixed32 | 32 | 32 | 32 | 32 | 32 |
.paddingFixed48 | 48 | 48 | 48 | 48 | 48 |
.paddingFixed56 | 56 | 56 | 56 | 56 | 56 |
.paddingFixed72 | 72 | 72 | 72 | 72 | 72 |
VStack(spacing: .paddingS) {
Text("Summary")
Text("Details")
}
.padding(.paddingL)
Height tokens
Height tokens follow the active FSpacingScale.
| Token | XS | S | M | L | XL |
|---|---|---|---|---|---|
.height4XS | 14 | 18 | 22 | 26 | 30 |
.height3XS | 18 | 22 | 26 | 30 | 34 |
.height2XS | 22 | 26 | 30 | 34 | 38 |
.heightXS | 26 | 30 | 34 | 38 | 42 |
.heightS | 30 | 34 | 38 | 42 | 46 |
.heightM | 34 | 38 | 42 | 46 | 50 |
.heightL | 38 | 42 | 46 | 50 | 54 |
.heightXL | 42 | 46 | 50 | 54 | 58 |
.height2XL | 46 | 50 | 54 | 58 | 62 |
.height3XL | 50 | 54 | 58 | 62 | 66 |
.height4XL | 54 | 58 | 62 | 66 | 70 |
.height5XL | 58 | 62 | 66 | 70 | 74 |
Radius tokens
FRadiusScale selects the active roundness column. The .none scale resolves every scalable radius to 0; .rounded resolves every scalable radius to 100. The table shows the five intermediate scales.
| Token | XS | S | M | L | XL |
|---|---|---|---|---|---|
.radiusNone | 0 | 0 | 0 | 0 | 0 |
.radiusFixed1 | 1 | 1 | 1 | 1 | 1 |
.radiusStandard | 6 | 8 | 16 | 24 | 28 |
.radius4XS | 0 | 2 | 4 | 6 | 8 |
.radius3XS | 2 | 4 | 6 | 8 | 10 |
.radius2XS | 4 | 6 | 8 | 10 | 12 |
.radiusXS | 6 | 8 | 10 | 12 | 14 |
.radiusS | 8 | 10 | 12 | 14 | 16 |
.radiusM | 10 | 12 | 14 | 16 | 18 |
.radiusL | 12 | 14 | 16 | 18 | 20 |
.radiusXL | 14 | 16 | 18 | 20 | 22 |
.radius2XL | 16 | 18 | 20 | 22 | 24 |
.radius3XL | 18 | 20 | 22 | 24 | 26 |
.radius4XL | 20 | 22 | 24 | 26 | 28 |
.radius5XL | 22 | 24 | 26 | 28 | 30 |
.radiusFixed32 | 32 | 32 | 32 | 32 | 32 |
.radiusFixed48 | 48 | 48 | 48 | 48 | 48 |
RoundedRectangle(cornerRadius: .radiusM)
.fill(.secondaryBackground)