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

    EdgeInsets

    The padding to apply.

    Font

    The 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) -> EdgeInsets

    Parameters

    theme

    The current theme to use for spacing tokens.

    Return Value

    An EdgeInsets value 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) -> Font

    Parameters

    theme

    The theme from which to retrieve font styles.

    Return Value

    A Font appropriate 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