Fixed width sidebar

126 views
Skip to first unread message

Greg L

unread,
Feb 26, 2015, 8:30:05 PM2/26/15
to shiny-...@googlegroups.com
hi
Is there a way to have a sidebar layout in shiny with a fixed width sidebar? 
sidebarLayout() just puts 2 fluid width columns together. If I fix the width of the sidebar there, the main panel doesn't fill up the rest of the page.

The only solution I have now is kind of ugly and looks something like this:

  div(
    div(style = "width:100%; margin-left: -300px; float: right;", 
        div(style = "margin-left: 340px;", mainPnl)
    ),
    div(style = "float:left; width: 300px;", 
        sidebarPnl
    )
  )

I'm hoping to do this in a much more shiny/bootstrap friendly way... thanks

Joe Cheng

unread,
Feb 27, 2015, 12:48:48 PM2/27/15
to Greg L, shiny-...@googlegroups.com
Maybe something like this:

basicPage(
  h1("Title"),
  div(style="position: relative;",
    wellPanel(style="position: absolute; width: 300px; left: 0; top: 0; height: auto;",
      "sidebar content"
    ),
    div(style="position: absolute; left: 310px; right: 0; top: 0; height: auto;",
      "main content"
    )
  )
)



--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/aeca1fa0-0240-4a06-b5d0-7dcc6fb7e694%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages