Last active
October 1, 2020 22:52
-
-
Save tylerlittlefield/2c8b9ab003e13beacdfca48415431d90 to your computer and use it in GitHub Desktop.
Experimental "compartment" or container for shiny UI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compartment <- function(title, ...) { | |
container_css <- stringr::str_squish( | |
"border: 3px solid orange; | |
position: relative; | |
border-radius: 8px; | |
padding-top: 20px; | |
font-family: 'Fira Sans', sans-serif; | |
margin-top: 25px; | |
margin-bottom: 25px;" | |
) | |
label_css <- stringr::str_squish( | |
"font-family: 'Fira Sans', sans-serif; | |
font-size: 22px; | |
color: white; | |
position: absolute; | |
top: -10px; | |
left: 20px; | |
height: 35px; | |
background-color: orange; | |
border: 3px solid orange; | |
text-align: center; | |
border-radius: 4px; | |
padding-left: 10px; | |
padding-right: 10px;" | |
) | |
shiny::tagList( | |
shiny::tags$style(shiny::HTML( | |
"@import url('https://fonts.googleapis.com/css2?family=Fira+Sans&display=swap');" | |
)), | |
shiny::tags$div( | |
style = container_css, | |
shiny::tags$div( | |
style = label_css, | |
title | |
), | |
... | |
) | |
) | |
} | |
htmltools::browsable( | |
fluidPage( | |
column( | |
width = 12, | |
compartment( | |
title = "Compartment A", | |
fluidPage( | |
h3("content here") | |
) | |
), | |
compartment( | |
title = "Compartment B", | |
fluidPage( | |
h3("content here") | |
) | |
), | |
compartment( | |
title = "Compartment C", | |
fluidPage( | |
h3("content here"), | |
h3("more content here") | |
) | |
) | |
) | |
) | |
) |
Author
tylerlittlefield
commented
Oct 1, 2020
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment