com.google.android.libraries.places.compose

Interfaces

PlaceDetailsCompactContentSlots

Slots available for custom content in advanced compact place details composables.

PlaceDetailsCompactSlotScope

The scope in which custom content slot composables are rendered.

PlaceMarkerState

A lightweight state holder that captures location coordinates and loaded place metadata for a PlaceMarker, enabling seamless integration with Compose map SDKs and custom UI layouts.

PlaceReference

Defines the reference to the place to be displayed.

Classes

PlaceReference.Coordinates

Reference to a place by geographic latitude/longitude coordinates.

PlaceReference.PlaceId

Reference to a place by its unique Place ID string.

PlaceReference.ResourceName

Reference to a place by its resource name (e.g., "places/ChIJ...").

Enums

AdvancedPlaceDetailsCompactContent

Content elements that can be selectively enabled for display in compact advanced place details widgets.

Orientation

Orientation of a place details composable.

Top-level functions summary

Unit
@Composable
AdvancedPlaceDetailsCompact(
    reference: PlaceReference,
    modifier: Modifier,
    orientation: Orientation,
    content: Set<AdvancedPlaceDetailsCompactContent>,
    preferTruncation: Boolean,
    enableLightbox: Boolean,
    searchMediaOptions: SearchMediaOptions?,
    onMediaSearchResult: ((MediaSearchResult) -> Unit)?,
    mainActions: (Place) -> List<MainAction>,
    cornerActions: (Place) -> List<CornerAction>,
    onPlaceLoaded: ((Place) -> Unit)?,
    onPlaceLoadFailed: ((ApiException) -> Unit)?,
    slots: PlaceDetailsCompactContentSlots.() -> Unit
)

A native Jetpack Compose Composable that displays details of a place in a compact format with advanced features.

Unit
@Composable
PlaceMarker(
    state: PlaceMarkerState,
    modifier: Modifier,
    beakPresence: Boolean
)

Renders the Jetpack Compose Place Marker UI driven by the given PlaceMarkerState.

Unit
@Composable
PlaceMarker(
    reference: PlaceReference,
    icon: MarkerIcon,
    modifier: Modifier,
    text: MarkerText?,
    beakPresence: Boolean,
    onClick: ((Place) -> Unit)?,
    onMarkerLoaded: ((Place) -> Unit)?,
    onMarkerLoadFailed: ((Place?, Exception) -> Unit)?
)

A native Jetpack Compose Composable that displays a Place Marker.

PlaceMarkerState
@Composable
rememberPlaceMarkerState(
    reference: PlaceReference,
    icon: MarkerIcon,
    text: MarkerText?,
    onMarkerLoaded: ((Place) -> Unit)?,
    onMarkerLoadFailed: ((Place?, Exception) -> Unit)?
)

Remembers a PlaceMarkerState and drives background data fetching and asset decoding scoped to the Compose lifecycle.

Top-level functions

AdvancedPlaceDetailsCompact

@Composable
fun AdvancedPlaceDetailsCompact(
    reference: PlaceReference,
    modifier: Modifier = Modifier,
    orientation: Orientation = Orientation.VERTICAL,
    content: Set<AdvancedPlaceDetailsCompactContent> = AdvancedPlaceDetailsCompactContent.STANDARD_CONTENT,
    preferTruncation: Boolean = false,
    enableLightbox: Boolean = false,
    searchMediaOptions: SearchMediaOptions? = null,
    onMediaSearchResult: ((MediaSearchResult) -> Unit)? = null,
    mainActions: (Place) -> List<MainAction> = { listOf(MainAction.OpenInMaps()) },
    cornerActions: (Place) -> List<CornerAction> = { emptyList() },
    onPlaceLoaded: ((Place) -> Unit)? = null,
    onPlaceLoadFailed: ((ApiException) -> Unit)? = null,
    slots: PlaceDetailsCompactContentSlots.() -> Unit = {}
): Unit

A native Jetpack Compose Composable that displays details of a place in a compact format with advanced features.

Parameters
reference: PlaceReference

The PlaceReference specifying the place to fetch and display.

modifier: Modifier = Modifier

The Modifier to be applied to this widget's outermost layout.

orientation: Orientation = Orientation.VERTICAL

The Orientation of the compact widget (VERTICAL or HORIZONTAL). Defaults to Orientation.VERTICAL.

content: Set<AdvancedPlaceDetailsCompactContent> = AdvancedPlaceDetailsCompactContent.STANDARD_CONTENT

The set of AdvancedPlaceDetailsCompactContent elements to display. Defaults to AdvancedPlaceDetailsCompactContent.STANDARD_CONTENT.

preferTruncation: Boolean = false

Whether content is truncated to fit into a single line. Defaults to false.

enableLightbox: Boolean = false

Whether to enable tap-to-expand lightbox functionality for media. Defaults to false.

searchMediaOptions: SearchMediaOptions? = null

The SearchMediaOptions to use when searching media. Defaults to null.

onMediaSearchResult: ((MediaSearchResult) -> Unit)? = null

Callback invoked when media search completes. Defaults to null.

mainActions: (Place) -> List<MainAction> = { listOf(MainAction.OpenInMaps()) }

A lambda producing a list of MainAction items to display for the place. Receives a Place with only Place.id, Place.location, and Place.viewport set. Defaults to a single MainAction.OpenInMaps action. Pass { emptyList() } to hide all main actions.

cornerActions: (Place) -> List<CornerAction> = { emptyList() }

A lambda producing a list of CornerAction items to display in the corner of the widget. Receives a Place with only Place.id, Place.location, and Place.viewport set. Defaults to an empty list.

onPlaceLoaded: ((Place) -> Unit)? = null

Callback invoked when the internal place fetch completes successfully. Receives a Place with only Place.id, Place.location, and Place.viewport set. Defaults to null.

onPlaceLoadFailed: ((ApiException) -> Unit)? = null

Callback invoked when the internal place fetch fails. Defaults to null.

slots: PlaceDetailsCompactContentSlots.() -> Unit = {}

A lambda configuring custom content slots in PlaceDetailsCompactContentSlots. Defaults to an empty lambda.

PlaceMarker

@Composable
fun PlaceMarker(
    state: PlaceMarkerState,
    modifier: Modifier = Modifier,
    beakPresence: Boolean = true
): Unit

Renders the Jetpack Compose Place Marker UI driven by the given PlaceMarkerState.

Use this overload when integrating with maps (e.g. MarkerComposable) or when state hoisting is desired to coordinate marker lifecycle or coordinates.

Parameters
state: PlaceMarkerState

The PlaceMarkerState managing place data and coordinates.

modifier: Modifier = Modifier

The Modifier to be applied to this composable.

beakPresence: Boolean = true

Whether the downward-pointing triangle (beak) beneath the marker bubble is shown. Defaults to true.

PlaceMarker

@Composable
fun PlaceMarker(
    reference: PlaceReference,
    icon: MarkerIcon,
    modifier: Modifier = Modifier,
    text: MarkerText? = null,
    beakPresence: Boolean = true,
    onClick: ((Place) -> Unit)? = null,
    onMarkerLoaded: ((Place) -> Unit)? = null,
    onMarkerLoadFailed: ((Place?, Exception) -> Unit)? = null
): Unit

A native Jetpack Compose Composable that displays a Place Marker.

All marker types fetch place details and render the marker UI when required attribute data is available.

This convenience overload automatically creates and remembers an internal PlaceMarkerState.

Parameters
reference: PlaceReference

The PlaceReference specifying the place to fetch and display.

icon: MarkerIcon

The MarkerIcon specifying which icon variant to display.

modifier: Modifier = Modifier

The Modifier to be applied to this composable.

text: MarkerText? = null

The optional MarkerText specifying which text variant to display. Defaults to null.

beakPresence: Boolean = true

Whether the downward-pointing triangle (beak) beneath the marker bubble is shown. Defaults to true.

onClick: ((Place) -> Unit)? = null

Optional callback invoked when the marker bubble is clicked. Receives a Place with only Place.id, Place.location, and Place.viewport set. Defaults to null.

onMarkerLoaded: ((Place) -> Unit)? = null

Optional callback invoked when the place details have been successfully fetched and the marker is ready to display. Receives a Place with only Place.id, Place.location, and Place.viewport set. Defaults to null.

onMarkerLoadFailed: ((Place?, Exception) -> Unit)? = null

Optional callback invoked when fetching place details fails or required attribute data is missing. Receives a Place (with only Place.id, Place.location, and Place.viewport set) if place details were fetched before the failure, or null otherwise, and the Exception describing the failure. Defaults to null.

rememberPlaceMarkerState

@Composable
fun rememberPlaceMarkerState(
    reference: PlaceReference,
    icon: MarkerIcon,
    text: MarkerText? = null,
    onMarkerLoaded: ((Place) -> Unit)? = null,
    onMarkerLoadFailed: ((Place?, Exception) -> Unit)? = null
): PlaceMarkerState

Remembers a PlaceMarkerState and drives background data fetching and asset decoding scoped to the Compose lifecycle.

Parameters
reference: PlaceReference

The PlaceReference specifying the place to fetch and display.

icon: MarkerIcon

The MarkerIcon specifying which icon variant to display.

text: MarkerText? = null

The optional MarkerText specifying which text variant to display. Defaults to null.

onMarkerLoaded: ((Place) -> Unit)? = null

Optional callback invoked when the place details have been successfully fetched and the marker is ready to display. Receives a Place with only Place.id, Place.location, and Place.viewport set. Defaults to null.

onMarkerLoadFailed: ((Place?, Exception) -> Unit)? = null

Optional callback invoked when fetching place details fails or required attribute data is missing. Receives a Place (with only Place.id, Place.location, and Place.viewport set) if place details were fetched before the failure, or null otherwise, and the Exception describing the failure. Defaults to null.