<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macOS: 15.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/pointerStyle(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE12pointerStyleyQrAA07PointerE0VSgF"
  },
  "title" : "pointerStyle(_:)"
}
-->

# pointerStyle(_:)

Sets the pointer style to display when the pointer is over the view.

```
nonisolated func pointerStyle(_ style: PointerStyle?) -> some View
```

## Parameters

`style`

The pointer style to use.

## Return Value

A view that changes the style of the pointer when hovered.

## Discussion

Refer to [`PointerStyle`](/documentation/SwiftUI/PointerStyle) for a list of available pointer styles.

For guidance on choosing an appropriate pointer style, refer to
<doc://com.apple.documentation/design/Human-Interface-Guidelines/pointing-devices>
in the Human Interface Guidelines.

In this example, the pointer style indicates rectangular selection is
possible while the Option modifier key is pressed:

```
enum ToolMode {
    // ...
    case selection
}

struct ImageEditorView: View {
    @State private var toolMode?

    var body: some View {
        ImageCanvasView()
            .pointerStyle(
                toolMode == .selection ? .rectSelection : nil)
            .onModifierKeysChanged { _, modifierKeys in
                if modifierKeys.contains(.option) {
                    toolMode = .selection
                } else {
                    toolMode = nil
                }
            }
    }
}
```

---

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)