79763150

Date: 2025-09-12 16:10:39
Score: 0.5
Natty:
Report link

Here is my solution without using value_box function of library(bslib) library(bsicons).

output of code


title: "Count N" format: dashboard server: shiny


#| context: setup

library(shiny)
library(shinyWidgets)
library(tidyverse)

data <- tibble::tibble(a = c(1, 2, 3)) # The data should always be retrieved from a server when the dashboard starts later, that's why I need the server context

{.sidebar width="20%"}

 

 sliderInput(
      inputId = "myValue",
      label = "custom slider",
      min = 1,
      max = 50,
      value = 30
    )


 

Row {height="20%"}

#| title: "n1"
#| icon: "trash"
#| color: teal

 textOutput("n1")
#| content: valuebox
#| title: "n4"
#| icon: pencil
#| color: teal

 textOutput("n4")

Row {height="30%"}

Column {.tabset}

#| content: valuebox
#| title: "n2"
#| icon: music
#| color: teal

 textOutput("n2")
#| content: valuebox
#| title: "n2"
#| icon: music
#| color: teal

 textOutput("n2")

Fixed Value: n3

#| content: valuebox
#| title: "Fixed Value: n3"
#| icon: "trash"
#| color: "danger"



textOutput("myFixValue")

Column {height="70%"}

#| title: "Dynamic Value Depends on Slider"


textOutput("myValueText")

 
#| context: server

 

  n <- data |> nrow() |> as.character()
  
 

  output$n1 <- renderText(n)
  output$n4 <- renderText(paste0("my new value:", " ", n))
  
   output$n2 <- renderText(n)
  
  n3 <- 99 |> as.character()
  
  output$myFixValue <- renderText(n3)
  
  output$myValueText <- renderText({  input$myValue})
  
Reasons:
  • Blacklisted phrase (0.5): I need
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: OkkesDulgerci