<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/PrimitiveButtonStyle/glass(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI20PrimitiveButtonStylePA2A05GlassdE0VRszrlE5glassyAeA0F0VFZ"
  },
  "title" : "glass(_:)"
}
-->

# glass(_:)

A button style that applies a configurable Liquid Glass effect based on the button’s context.

```
nonisolated static func glass(_ glass: Glass) -> Self
```

## Discussion

This button style applies a Liquid Glass effect that you can customize by specifying a tint or variant. In the following example, the button renders using the clear variant of Liquid Glass:

```swift
Button("Button") {}
    .buttonStyle(.glass(.clear))
```

In tvOS, this button style applies a Liquid Glass effect regardless of whether the button has focus. This style is similar to the [`bordered`](/documentation/SwiftUI/PrimitiveButtonStyle/bordered) style.

To apply this style to a button, or to a view that contains buttons, use
the [`buttonStyle(_:)`](/documentation/SwiftUI/View/buttonStyle(_:)-66fbx) modifier.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)