1

I would like to insert the up and down arrows next to the Maximize and Minimize options in choices. So I would like to leave it as follows:

Maximize ↑

Minimize ↓

library(shiny)

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      fluidRow(
       column(
          width = 6,
          selectInput("maxmin", label = h5("Maximize or Minimize"),
choices = list("Maximize " = 1, "Minimize" = 2), selected = "")
        )
      )),
      
    mainPanel(
      
    ))
  
)

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

shinyApp(ui = ui, server = server)

enter image description here

Antonio
  • 1,091
  • 7
  • 24

1 Answers1

2

We could use unicode

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      fluidRow(
        column(
          width = 6,
          selectInput("maxmin", label = h5("Maximize or Minimize"),
                      choices = list("Maximize \u2191" = 1, "Minimize \u2193" = 2), selected = "")
        )
      )),
    
    mainPanel(
      
    ))
  
)

-testing

enter image description here

akrun
  • 874,273
  • 37
  • 540
  • 662
  • Thanks for answering. I did the same thing you did but mine didn't show up. Strange no? I inserted the image in the question of how it turned out. – Antonio Mar 13 '22 at 16:30
  • @Antonio I changed only that part as I showed and nothing else – akrun Mar 13 '22 at 16:31
  • @Antonio can you show `packageVersion('shiny')`. I used `1.6.0` – akrun Mar 13 '22 at 16:32
  • Yes, It is: `packageVersion('shiny')` `[1] ‘1.6.0’` – Antonio Mar 13 '22 at 16:40
  • @Antonio I am not sure about the issue. I tried on Rstudio in macOS and it is working correctly for me – akrun Mar 13 '22 at 16:41
  • No problem, I'm seeing what it could be. Because I used exactly your code. I'll try restarting RStudio to see. – Antonio Mar 13 '22 at 16:42
  • @Antonio Can you show your `sessionInfo()` in your post – akrun Mar 13 '22 at 16:42
  • @Antonio I am guessing that your issue is a case of encoding. Can you try the soluiton [here](https://stackoverflow.com/questions/23324872/rstudio-not-picking-the-encoding-im-telling-it-to-use-when-reading-a-file) – akrun Mar 13 '22 at 16:47
  • appears when I run the code: `Warning messages: 1: unable to translate 'Maximize ' to native encoding 2: unable to translate 'Minimize ' to native encoding ` Now that I've seen it. It's a coding issue, right? – Antonio Mar 13 '22 at 16:49
  • @Antonio can you try the solution in the link I shared in comments above for encoding issue – akrun Mar 13 '22 at 16:51
  • I will check now – Antonio Mar 13 '22 at 16:52
  • @Antonio This is actually an encoding issue and it is not related to the solution I posted. – akrun Mar 13 '22 at 18:54
  • I agree, therefore I will accept your answer. – Antonio Mar 13 '22 at 18:58