MaterialActiveAppearance

The behavior for how materials appear active and inactive.

StructureiOS 18.0+macOS 15.0+tvOS 18.0+watchOS 11.0+visionOS 2.0+MaterialActiveAppearance in SwiftUI

Declaration

React
type MaterialActiveAppearance = 'active' | 'automatic' | 'matchWindow';
Swift
struct MaterialActiveAppearance

Pass a literal, or build one with SwiftUI.MaterialActiveAppearance from import { SwiftUI } from 'swiftui-react-native'.

Type properties

Overview

On macOS, materials have active and inactive appearances that can reinforce the active appearance of the window they are in:

  • Materials used as a window container background and bar materials will appear inactive when their containing window is inactive.
  • All other materials will always appear active by default.

An explicit active appearance can be set to override a material's default behavior. For example, materials used as the window container background can be made to always appear active by setting the active appearance behavior to be always active:

Text("Hello, World!")
    .containerBackground(
        Material.regular.materialActiveAppearance(.active),
        for: .window)

From Apple’s SwiftUI documentation. Code samples there are Swift.

Used by

See also

More in Drawing and shapes.