<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: 18.4.0 -",
    "macOS: 15.4.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebExtension/actionIcon(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKWebExtension(im)actionIconForSize:"
  },
  "title" : "actionIcon(for:)"
}
-->

# actionIcon(for:)

Returns the default action icon for the specified size.

```
func actionIcon(for size: CGSize) -> UIImage?
```

## Parameters

`size`

The size to use when looking up the action icon.

## Return Value

The action icon, or `nil` if the icon was unable to be loaded.

## Discussion

This icon serves as a default and should be used to represent the extension in contexts like action sheets or toolbars prior to the extension being loaded into an extension context. Once the extension is loaded, use the [`action(for:)`](/documentation/WebKit/WKWebExtensionContext/action(for:)) API to get the tab-specific icon.

The returned image will be the best match for the specified size that is available in the extension’s action icon set. If no matching icon is available, the method will fall back to the extension’s icon.

## See Also

[`icon(for:)`](/documentation/WebKit/WKWebExtension/icon(for:))

Returns the extension’s icon image for the specified size.



---

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)