Skip to contents

Use a separate clickable icon to indicate that a room has comments or visitor accounts. A room’s ordinary popup and photo carousel remain available by clicking the room itself. Only the active floor’s comment icons are displayed.

Associate comments with rooms

Use one row per comment. Repeating a layerId displays several comments in catalogue order. Only rooms with catalogue entries receive an icon. The following comments are explicitly fictional demonstration text.

room_comments <- indoorCommentCatalog(
  layerId = c("feature-01", "feature-01", "feature-06"),
  text = c(
    "A quiet place for our group discussion.",
    "The entrance was easy to find.",
    "I enjoyed the reading space upstairs."
  ),
  author = c("Example visitor A", "Example visitor B", "Example visitor C"),
  title = "Fictional demonstration comment"
)

leaflet(indoor_demo, height = 480, options = leafletOptions(
  crs = leafletCRS("L.CRS.Simple")
)) |>
  addIndoor(
    layerId = ~feature_id,
    label = ~name,
    popup = ~description,
    comments = room_comments,
    commentOptions = indoorCommentOptions(icon = "comment"),
    crs = "simple"
  ) |>
  addIndoorControl(position = "bottomright")

Click the purple speech bubble beside the Meeting room to read two comments. Choose floor 1 to see the Reading room’s icon. Icons also work with Enter and Space; Escape closes the comment popup and returns focus to its icon. Long comment lists scroll within the popup.

The room reference point stays on the feature surface, including concave rooms and rooms with holes. The exterior-edge anchor uses a planar calculation in the map’s normalized coordinates, suitable for building-scale maps.

Choose an icon and translate the labels

The icon argument accepts "comment", "quote", and "info", or a short plain-text symbol. Built-in icons use bundled SVG paths and need no external font or icon service. Colors use hexadecimal notation.

By default, placement = "edge" puts each badge just outside the room’s exterior boundary. A short connector identifies its room, and the entire clickable target is offset to keep the room’s interior reference point free for its normal popup or photos. Holes are excluded when choosing the edge. Use placement = "center" to place the badge at the interior reference point. Point and line features use a nearby offset when they have no exterior ring.

The badge and its icon resize together as the map zoom changes. By default, the visual diameter fits 75% of the room’s shorter projected bounding-box dimension, bounded by min_size = 12 and size = 36 pixels. The minimum preserves visibility when a room becomes very small. Point features retain the configured size. The clickable target remains at least 44 pixels. Use fit_to_room = FALSE for a fixed visual diameter, or choose different size and min_size values.

indoorCommentOptions(
  icon = "quote",
  background_color = "#7c3aed",
  marker_label = "Lire les témoignages",
  popup_label = "Témoignages",
  source_label = "Lire la source"
)
#> $icon
#> [1] "quote"
#> 
#> $color
#> [1] "#ffffff"
#> 
#> $backgroundColor
#> [1] "#7c3aed"
#> 
#> $show
#> [1] TRUE
#> 
#> $markerLabel
#> [1] "Lire les témoignages"
#> 
#> $popupLabel
#> [1] "Témoignages"
#> 
#> $sourceLabel
#> [1] "Lire la source"
#> 
#> $size
#> [1] 36
#> 
#> $minSize
#> [1] 12
#> 
#> $fitToRoom
#> [1] TRUE
#> 
#> $placement
#> [1] "edge"
#> 
#> attr(,"class")
#> [1] "leaflet_indoor_comment_options"

indoorCommentOptions(icon = "\u2605", background_color = "#0b5cab")
#> $icon
#> [1] "★"
#> 
#> $color
#> [1] "#ffffff"
#> 
#> $backgroundColor
#> [1] "#0b5cab"
#> 
#> $show
#> [1] TRUE
#> 
#> $markerLabel
#> [1] "Read room comments"
#> 
#> $popupLabel
#> [1] "Room comments"
#> 
#> $sourceLabel
#> [1] "Read source"
#> 
#> $size
#> [1] 36
#> 
#> $minSize
#> [1] 12
#> 
#> $fitToRoom
#> [1] TRUE
#> 
#> $placement
#> [1] "edge"
#> 
#> attr(,"class")
#> [1] "leaflet_indoor_comment_options"

Set show = FALSE to retain the comments without drawing their icons, or omit comments entirely. Replacing or clearing an indoor data set also replaces or clears its comment markers. Comment fields are always plain text; HTML-looking strings are displayed literally. Optional source links must be absolute HTTP(S) URLs. Optional author, date, source, and title fields use empty strings when omitted. Dates are displayed as supplied.

Published visitor accounts at the Louvre

The bundled Louvre example includes four short excerpts or summaries from three published first-person accounts. They are associated with three named rooms in the dated OpenStreetMap snapshot:

Room Floor Account
Salle de la Vénus de Milo 0 Jitka Tupa’s reflection on incomplete sculptures, explicitly labelled as a summary.
Salle des États 1 Short excerpts by patricia_pham (UMass Lowell) and Jitka Tupa about seeing the Mona Lisa.
Galerie d’Apollon 1 A short excerpt by Michele (Malaysian Meanders), reacting to her children sharing discoveries in the gallery.
louvre_comments <- read.csv(
  system.file("examples", "real", "louvre-comments.csv", package = "leaflet.indoor"),
  stringsAsFactors = FALSE,
  fileEncoding = "UTF-8"
)
louvre_comments[c("author", "date", "title")]
#>                         author                 date
#> 1                   Jitka Tupa Published 2015-09-24
#> 2 patricia_pham (UMass Lowell) Published 2025-03-11
#> 3                   Jitka Tupa Published 2015-09-24
#> 4 Michele (Malaysian Meanders) Published 2013-09-04
#>                                                                      title
#> 1                                 Published account summary: Venus de Milo
#> 2                                      Short excerpt: seeing the Mona Lisa
#> 3                            Short excerpt: the crowd around the Mona Lisa
#> 4 Short excerpt: her children sharing discoveries in the Galerie d'Apollon
louvre_example <- source(
  system.file("examples", "louvre-photo-carousel.R", package = "leaflet.indoor"),
  local = new.env(parent = globalenv())
)
#> Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.4.0; sf_use_s2() is TRUE
louvre_example$value

Click a purple quotation icon to read an account and follow its source link. On floor 0, the Vénus de Milo room also has a photograph. Click the room away from its icon to open the photo. Select floor 1 for the Salle des États and Galerie d’Apollon accounts. Dates shown are publication dates. These are historical personal accounts, not a survey or a description of present-day conditions at the museum.

Original sources, checked on 2026-10-06:

The installed file examples/real/COMMENT-SOURCES.md records the exact passages, publication dates, author attribution, and room associations. The Louvre’s official pages identify Salle des États and the Vénus de Milo room.

Shiny

Clicking a comment icon produces input$MAPID_indoor_comment_click, containing id, dataset_id, level, lat, lng, and comment_count. Ordinary room clicks retain their separate input$MAPID_indoor_feature_click event. Use addIndoor() on a leafletProxy() with the same dataset_id to replace comments or change their icon options; use setIndoorLevel() to change the floor, or clearIndoor() to remove the data set’s features and icons.