ThemeButtonStyle

@MainActor
public struct ThemeButtonStyle : ButtonStyle

A comprehensive button style that applies consistent theming across different button variants, shapes, sizes, and font styles.

ThemeButtonStyle supports:

  • Filled, Tonal, Outline, Elevated, and Text button variants
  • Destructive role styling (uses error colors)
  • Dynamic background and border colors for enabled, disabled, and pressed states
  • Adaptive padding, shape, font, and shadow based on theme tokens

Example:

Button("Save") { ... }
  .buttonStyle(ThemeButtonStyle(variant: .filled, size: .large))

Use this style in conjunction with applyThemeButtonStyle(), buttonVariant(), etc. for more declarative usage in your design system.

Parameters

variant

The visual variant of the button (e.g., .filled, .outline, etc.).

size

The padding and font size configuration.

shape

The corner style for the button.

font

Optional override for the font style and weight.