Shiny-NavbarPage- navbarList-tabPanel- Static proper formatted text

Hello There.

I would like to create a navbar in which the fist tab has a navlistPanel on the left which is consist of several parts like so:

ui = navbarPage("Whatever", inverse=TRUE, collapsable=TRUE,
                tabPanel(title = "Home",
                         fluidRow(
                           column(5, offset = 0,  
                                 navlistPanel(
                                   tabPanel(title = "About", br(), textOutput('aboutText')),
                                   tabPanel(title = "Contact Us", br(), textOutput('PeopleNames'))
                                 )
                                )
                         )
                         )

How can I add a text file for each section. For example I want to have a text when I click on "About"
or "Contact Us".

I want for the text to have title which is bold and centered, etc.

P.S. Perhaps the textOutput('aboutText') I wrote in there is not the best practice(?)

Example:


Any help is deeply appreciated.
Best

When you are designing an UI, you can use HTML tags function of shiny to write the html part. Use shortcut like h1 or p, or use tags$h1 and other inside thetags element.
If you replace your textOuput part with that, you can write your UI.

library(shiny)
ui = navbarPage("Whatever", inverse = TRUE, collapsible = TRUE,
                tabPanel(title = "Home",
                         fluidRow(
                           column(5, offset = 0,  
                                  navlistPanel(
                                    tabPanel(title = "About", 
                                             br(), 
                                             h1("About text"),
                                             p("Explain who we are")
                                             ),
                                    tabPanel(title = "Contact Us", 
                                             br(), 
                                             h1('How to contact us?'),
                                             p("Tel & mail")
                                    )
                                  )
                           )
                         )
                )
)
shinyApp(ui, server = function(input, output){})

For styling, you can play with css then. (i.e for red title).

Read articles about UI and follow the tutorials on the shiny website to be accustom with all this.

Thank you very much cdrev,

I was thinking perhaps there is a better, cleaner way of doing it. Like having some sort of .txt or
.html ( one file per tabPanel like about.txt, people.txt) or whatever on the disk that R can read it off the disk, rather than typing a big chuck of text in the tabPanel.

Also, I am more than half way through the articles about UI. :slight_smile:

Thanks again.

Yes you can do that! You can load HTML file , a HTML template to complete, a markdown file to render as HTML , or surely store a shiny tag list in a rds to load when needed.

Don’t use text as you won’t be able to easily transform to HTML and apply css on it.

Great, Thanks, I will try that tomorrow.