Displaying information on click in timevis.r

I have made a timeline using timevis.r in R Shiny. I want to make information appear when a user clicks on an item in the timeline, however I am not sure how to do this. The code I have is this:

library(shiny)
library(timevis)


data <- data.frame(id = 1:10, 
content = c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"), 
title = c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J"), 
start = c("06/12/2017", "08/12/2017", "21/11/2012", "16/01/2013", "15/03/2013","09/12/2017", "20/12/2017", 

"25/11/2012", "01/01/2013", "02/03/2013"), 
group = c(1,1,1,2,2,3,4,1,3,3), 
location = c("Church Lane", "School Field", "Disco", "School Field","Church Lane", "School Field", "Disco", 

"Disco", "Church Lane", "School Field")

grouprs <- data.frame(id = 1:4, content = c("Safety", "Information of concern", 
                                            "Complaint", "Other"))

options <- list(min = "01/01/2010" , max ="01/01/2020", zoomMin = 86400000))

names <- as.character( unique(data$location) )


ui <- fluidPage(
  theme = "timeline.css",
    
  sidebarLayout(
    
    sidebarPanel(
      selectInput( "location", "Location", names ),
    ),
    
    mainPanel(
  tabsetPanel(
    tabPanel( "Timeline", h1( "Timeline" ),
  textOutput("location"),
  timevisOutput( "timeline" )),
    tabPanel( "tab2", "Blank tab" ),
  textOutput("entry") # trying to get the title of the item to appear here when user clicks on the item
  ) 
)))

server <- function(input, output, session) {
  

  locationData <- reactive({ 
                            subdata[subdata$location == as.character(input$location), ] })
  
  output$location <- renderText(input$location)
  
  output$timeline <- renderTimevis({
    timevis(locationData(), groups = grouprs, options = options)
  })


}

shinyApp(ui = ui, server = server)

I think I need to insert a javascript command but I am not sure where. Could I use tags$script to do that or would that be stupid? At the moment I would be happy just for something to display when the user selects an item- I think if I had that, I could get the rest of the way with making it the title of the item.
Any help/suggestions/nudges would be very welcome! I am pretty new to R and even newer to javascript.

Hi! Welcome to RStudio Community!

It looks like your code was not formatted correctly to make it easy to read for people trying to help you. Formatting code allows for people to more easily identify where issues may be occuring, and makes it easier to read, in general. I have edited you post to format the code properly.

In the future please put code that is inline (such as a function name, like mutate or filter) inside of backticks (`mutate`) and chunks of code can be put between sets of three backticks:

```
example <- foo %>%
  filter(a == 1)
```

This will help keep our community tidy and help you get the help you are looking for!

For more information, please take a look at the community's FAQ on formating code

Thank you, I will do that in future.

I have never used timevis before but it looks like you can pass options to the time timevis() function with the options argument. This allows you to pass options to the underlying javascript package that creates the timeline. Looking at the options available form the link in the help file, it looks like you probably want to use template option. However, I am not 100% sure as I have never used either the R package or the javascript library.