WebAppIcon

Updated: Oct 29, 2026
WebAppIcon presents transparent monochrome artwork on a complete app-icon material. Use it when a Meta Wearables app manifest provides icon artwork and either a theme color or an explicit radial palette.
The component owns the container gradient, focused inner glow, texture, glow stroke, partial-focus lighting, artwork treatment, and fallback. Your application owns manifest retrieval and validation and passes the resolved appearance values to the component. Use the hosted App Icon Generator⁠ to preview artwork and colors in app-icon contexts and download generated assets.

Usage

A theme color derives the container palette and tints the artwork:
import {WebAppIcon} from '@wearables-ui-toolkit/mrbd';

const iconSrc = new URL(
  manifest.appearance.icon.src,
  manifestUrl,
).href;

<WebAppIcon
  iconSrc={iconSrc}
  themeColor={manifest.appearance.theme_color}
  aria-label={manifest.name}
/>;
When the manifest provides an explicit icon background, map its fields to the corresponding props. themeColor continues to control the artwork tint when a radial palette is also present:
const iconSrc = new URL(
  manifest.appearance.icon.src,
  manifestUrl,
).href;

<WebAppIcon
  iconSrc={iconSrc}
  themeColor={manifest.appearance.theme_color}
  radialColors={manifest.appearance.icon_background?.colors}
  radialStops={manifest.appearance.icon_background?.stops}
  innerGlowColor={manifest.appearance.icon_background?.inner_glow_color}
  aria-label={manifest.name}
/>;
Resolve relative artwork URLs against the manifest URL before passing them to iconSrc. Cross-origin artwork must allow the Web App origin through Cross-Origin Resource Sharing (CORS).

Props

The full prop type is WebAppIconProps. It extends HTMLAttributes<HTMLDivElement> with children, onLoad, and onError omitted. Remaining DOM attributes are forwarded to the root div, and ref resolves to that element.
PropTypeDefaultDescription
iconSrc
string \| null
—
URL for transparent monochrome artwork.
themeColor
string \| null
—
CSS hexadecimal color used to tint the artwork and derive the container palette.
radialColors
readonly string[] \| null
—
Explicit radial-gradient colors. Each entry must be a CSS hexadecimal color.
radialStops
readonly number[] \| null
evenly distributed
Offsets for radialColors. The array is ignored unless its length matches and its values are ordered from 0 through 1.
innerGlowColor
string \| null
artwork tint
Focused inner-glow color. It does not change the artwork tint or container gradient.
partialFocusLighting
boolean
true
Whether the foreground light follows partial focus.
width
number
112
Visible width in pixels.
height
number
112
Visible height in pixels.
onIconReady
(succeeded: boolean) => void
—
Called after the requested artwork resolves. true means custom artwork is displayed; false means the fallback remains displayed.
className
string
''
Additional class appended to the component root.
style
ContainerRootStyle
—
Inline styles for the component root.

Material factory

Use createWebAppIconMaterial(options) when an interactive Container owns focus and activation. The factory returns the complete material, its medium-corner shape provider, and an isFallback value. Create a separate material for each mounted container because a material instance owns its host state.
import {
  Container,
  createWebAppIconMaterial,
} from '@wearables-ui-toolkit/mrbd';

const iconSrc = new URL(
  manifest.appearance.icon.src,
  manifestUrl,
).href;

const rendering = createWebAppIconMaterial({
  iconSrc,
  themeColor: manifest.appearance.theme_color,
});

<Container
  width={112}
  height={112}
  contentClip="none"
  material={rendering.material}
  shapeProvider={rendering.shapeProvider}
  aria-label={manifest.name}
  onClick={openWebApp}
/>;
The factory selects the fallback when artwork or valid appearance colors are missing. It does not preload the image or report loading failures; WebAppIcon provides those lifecycle behaviors.

Behavior

Fallback. Missing artwork, missing appearance colors, invalid hexadecimal colors, or an image load failure keeps the standard link artwork on a neutral palette. onIconReady(false) reports that result.
Monochrome artwork. The image alpha becomes a fitted mask in an artwork area that uses the canonical 64-to-112 ratio. The component adds a white face, a soft offset shadow, and a blurred theme-colored edge treatment inside the mask. Source colors are not preserved.
Color precedence. A valid explicit radial palette controls the container. When themeColor is also present, it controls the artwork tint. Without a theme color, the first radial color controls the tint. Invalid or mismatched radial stops are discarded while valid colors remain usable.
Sizing. The 112-pixel container and 64-pixel artwork define the canonical ratio. Smaller and larger bounds scale and center the complete surface. A material created with createWebAppIconMaterial also derives its artwork and effect geometry from the host container’s current bounds.
Display only.WebAppIcon does not own focus or activation. Use it inside a labelled interactive composition, or use createWebAppIconMaterial with Container when the icon itself is the interactive surface.

Accessibility

  • The component is decorative by default and hidden from assistive technology.
  • Pass a localized aria-label when the icon communicates identity on its own; the component then uses role="img" unless another role is supplied.
  • When the icon appears inside a labelled control, leave it decorative and put the accessible name on the control.
  • The material-factory example uses Container, so the container owns the accessible role, name, focus, and activation behavior.
  • Resolve and validate the Meta Wearables app manifest in application code, then pass the resolved appearance values to WebAppIcon.
  • Use transparent monochrome artwork with enough clear space around its visual bounds for the generated highlight, shadow, and edge treatment.
  • Reuse manifest appearance data directly instead of approximating the palette with CSS around the component.
  • Keep one material instance per mounted Container when using createWebAppIconMaterial.

Avoid

  • Avoid artwork that already includes its final background or color treatment; the component treats the complete source alpha as foreground artwork.
  • Avoid wrapping WebAppIcon in another material surface because the extra surface obscures its app-icon treatment. Use the material factory when a surrounding Container must own interaction.
  • Avoid cross-origin artwork without CORS access. Unavailable artwork uses the fallback.
  • Avoid adding click behavior directly to a display-only WebAppIcon. Use a semantic control or the documented Container composition instead.