Debian Codegraph @

man/sidebarLayout.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/bootstrap-layout.R
3 \name{sidebarLayout}
4 \alias{sidebarLayout}
5 \alias{sidebarPanel}
6 \alias{mainPanel}
7 \title{Layout a sidebar and main area}
8 \usage{
9 sidebarLayout(
10 sidebarPanel,
11 mainPanel,
12 position = c("left", "right"),
13 fluid = TRUE
14 )
15
16 sidebarPanel(..., width = 4)
17
18 mainPanel(..., width = 8)
19 }
20 \arguments{
21 \item{sidebarPanel}{The \code{sidebarPanel()} containing input controls.}
22
23 \item{mainPanel}{The \code{mainPanel()} containing outputs.}
24
25 \item{position}{The position of the sidebar relative to the main area ("left"
26 or "right").}
27
28 \item{fluid}{\code{TRUE} to use fluid layout; \code{FALSE} to use fixed
29 layout.}
30
31 \item{...}{Output elements to include in the sidebar/main panel.}
32
33 \item{width}{The width of the sidebar and main panel. By default, the
34 sidebar takes up 1/3 of the width, and the main panel 2/3. The total
35 width must be 12 or less.}
36 }
37 \description{
38 Create a layout (\code{sidebarLayout()}) with a sidebar (\code{sidebarPanel()}) and
39 main area (\code{mainPanel()}). The sidebar is displayed with a distinct
40 background color and typically contains input controls. The main
41 area occupies 2/3 of the horizontal width and typically contains outputs.
42 }
43 \examples{
44 ## Only run examples in interactive R sessions
45 if (interactive()) {
46 options(device.ask.default = FALSE)
47
48 # Define UI
49 ui <- fluidPage(
50
51 # Application title
52 titlePanel("Hello Shiny!"),
53
54 sidebarLayout(
55
56 # Sidebar with a slider input
57 sidebarPanel(
58 sliderInput("obs",
59 "Number of observations:",
60 min = 0,
61 max = 1000,
62 value = 500)
63 ),
64
65 # Show a plot of the generated distribution
66 mainPanel(
67 plotOutput("distPlot")
68 )
69 )
70 )
71
72 # Server logic
73 server <- function(input, output) {
74 output$distPlot <- renderPlot({
75 hist(rnorm(input$obs))
76 })
77 }
78
79 # Complete app with UI and server components
80 shinyApp(ui, server)
81 }
82 }
83 \seealso{
84 Other layout functions:
85 \code{\link{fillPage}()},
86 \code{\link{fixedPage}()},
87 \code{\link{flowLayout}()},
88 \code{\link{fluidPage}()},
89 \code{\link{navbarPage}()},
90 \code{\link{splitLayout}()},
91 \code{\link{verticalLayout}()}
92 }
93 \concept{layout functions}