I am using a Navbar page for my Shiny app. I would like to have an element, in my case an h2 title element, moved automatically to the bottom of the sidebar panel. I know I can produce the effect that I want to either the left or right of the sidebar panel by applying the float property to the h2 element title. However, I haven't found a way to produce a similar effect to move the h2 element to the bottom of the page/view automatically. Any pointers in the right direction is highly appreciated.
I've tried adding spans but I haven't made it work.
library(shiny)
library(shinyWidgets)
if (interactive()) {
ui <- navbarPage(
title = "SIMULATION",
id = "tabs",
selected = "HOME",
tabPanel(
"HOME",
sidebarLayout(
sidebarPanel(
width = 4,
h2("Standard Normal Distribution Simulation"),
numericInput("num", label = "Enter the number of observations", value = 100),
actionButton("calc", "Draw Plot", icon = icon("calculator")),
h2("Created with Shiny", style = "color:green; float:right;")
),
# paste0(h1("Plot of Normal Distribution:"), h2("mean: std:")),
mainPanel(
h1("Plot of Standard Normal Distribution"),
plotOutput("sim")
) # mainPanel
) # sidebar layout
) # tab panel
)
server <- function(input, output, session) {
output$sim <- renderPlot({
if (input$calc == 0){
return()
}
isolate({
# Plot of Random Points
vals <- rnorm(input$num)
plot(density(vals), main = "Normal Distribution")
})
})
}
shinyApp(ui, server)
}