ButtonSize
public enum ButtonSize : Equatable
Defines the size and layout configuration for themed buttons.
ButtonSize controls padding and font size for different button scales.
It also supports full-width layout and fully custom styles.
-
Small button size. Compact padding and a small font.
Declaration
Swift
case small -
Medium button size. Moderate padding and a larger label font.
Declaration
Swift
case medium -
Large button size. Generous padding and body-level typography.
Declaration
Swift
case large -
Full-width button. Stretches to fill horizontal space. Padding is applied vertically, and horizontal is handled via
.frame(maxWidth: .infinity).Declaration
Swift
case fullWidth -
A custom button size, allowing full control over both padding and font.
Declaration
Swift
case custom(EdgeInsets, Font)Parameters
EdgeInsetsThe padding to apply.
FontThe font to use for the label.
-
Computes the edge insets (padding) to apply for the given button size.
Declaration
Swift
public func paddingValues(for theme: Theme) -> EdgeInsetsParameters
themeThe current theme to use for spacing tokens.
Return Value
An
EdgeInsetsvalue that should be applied to the button. -
Resolves the appropriate font to use based on button size.
Declaration
Swift
public func font(for theme: Theme) -> FontParameters
themeThe theme from which to retrieve font styles.
Return Value
A
Fontappropriate for the current size. -
Compares two button sizes for equality.
Note: Custom sizes are treated as equal regardless of their actual content.
Declaration
Swift
public static func == (lhs: ButtonSize, rhs: ButtonSize) -> Bool