IconMarker

Functions summary

Unit
@Composable
IconMarker(
    contentDescription: String,
    modifier: Modifier,
    size: IconMarkerSize,
    contentColor: Color,
    contentPadding: PaddingValues,
    content: @Composable () -> Unit
)

Renders a non-interactive icon marker (a dot IconMarkerDefaults.DotIcon by default) for anchoring to real-world objects.

Unit
@Composable
IconMarker(
    onClick: () -> Unit,
    contentDescription: String,
    modifier: Modifier,
    size: IconMarkerSize,
    color: Color,
    contentColor: Color,
    contentPadding: PaddingValues,
    interactionSource: MutableInteractionSource?,
    content: @Composable () -> Unit
)

Renders a clickable icon marker (a dot IconMarkerDefaults.DotIcon by default) for anchoring to real-world objects.

Functions

IconMarker

@Composable
fun IconMarker(
    contentDescription: String,
    modifier: Modifier = Modifier,
    size: IconMarkerSize = IconMarkerSize.Medium,
    contentColor: Color = IconMarkerDefaults.contentColor(),
    contentPadding: PaddingValues = IconMarkerDefaults.contentPadding(size),
    content: @Composable () -> Unit = { IconMarkerDefaults.DotIcon() }
): Unit

Renders a non-interactive icon marker (a dot IconMarkerDefaults.DotIcon by default) for anchoring to real-world objects. For cases where a custom icon is required, provide an Icon to content slot.

Unlike the clickable IconMarker, this variant renders only the marker content without an interactive background surface or click handling.

Parameters
contentDescription: String

text used by accessibility services to describe a real-world object this marker is anchored to. This text should be localized. It will be merged with content description of the content so the latter one should be omitted.

modifier: Modifier = Modifier

the Modifier to be applied to this layout

size: IconMarkerSize = IconMarkerSize.Medium

the IconMarkerSize variant of the marker

contentColor: Color = IconMarkerDefaults.contentColor()

Color applied to content

contentPadding: PaddingValues = IconMarkerDefaults.contentPadding(size)

internal padding applied around content

content: @Composable () -> Unit = { IconMarkerDefaults.DotIcon() }

the marker content to display inside the surface. By default, this is a dot IconMarkerDefaults.DotIcon, but can be customized with an Icon. Size of the icon depends on the provided size.

IconMarker

@Composable
fun IconMarker(
    onClick: () -> Unit,
    contentDescription: String,
    modifier: Modifier = Modifier,
    size: IconMarkerSize = IconMarkerSize.Medium,
    color: Color = GlimmerTheme.colors.surface,
    contentColor: Color = IconMarkerDefaults.contentColor(color),
    contentPadding: PaddingValues = IconMarkerDefaults.contentPadding(size),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable () -> Unit = { IconMarkerDefaults.DotIcon() }
): Unit

Renders a clickable icon marker (a dot IconMarkerDefaults.DotIcon by default) for anchoring to real-world objects. For cases where a custom icon is required, provide an Icon to content slot.

This variant renders a clickable icon enclosed in an interactive surface.

import androidx.xr.glimmer.Icon
import androidx.xr.glimmer.IconMarker

IconMarker(
    onClick = {},
    // Provide a description of the real-world object that the marker tracks.
    contentDescription = "Northern Cardinal",
)
import androidx.xr.glimmer.Icon
import androidx.xr.glimmer.IconMarker

IconMarker(
    onClick = {},
    contentDescription = "Favourite meal",
    // The content description for the icon is redundant, as the marker merges the semantics.
    content = { Icon(FavoriteIcon, contentDescription = null) },
)
Parameters
onClick: () -> Unit

called when this marker is clicked.

contentDescription: String

text used by accessibility services to describe a real-world object this marker is anchored to. This text should be localized. It will be merged with content description of the content so the latter one should be omitted.

modifier: Modifier = Modifier

the Modifier to be applied to this layout

size: IconMarkerSize = IconMarkerSize.Medium

the IconMarkerSize variant of the marker

color: Color = GlimmerTheme.colors.surface

background Color of the interactive surface

contentColor: Color = IconMarkerDefaults.contentColor(color)

Color applied to content

contentPadding: PaddingValues = IconMarkerDefaults.contentPadding(size)

internal padding between the surface and content

interactionSource: MutableInteractionSource? = null

an optional hoisted MutableInteractionSource for observing and emitting interactions for this marker. Note that if null is provided, interactions will still happen internally

content: @Composable () -> Unit = { IconMarkerDefaults.DotIcon() }

the marker content to display inside the surface. By default, this is a dot IconMarkerDefaults.DotIcon, but can be customized with an Icon. Size of the icon depends on the provided size.