formGroup: Input labels, help text, and formatting to inputs

View source: R/forms.R

formGroupR Documentation

Input labels, help text, and formatting to inputs

Description

Form groups are a way of labeling an input. Form rows are similar to columns()s, but include additional styles intended for forms. The flexibility provided by form rows and groups means you can confidently develop shiny applications for devices and screens of varying sizes.

Usage

formGroup(label, input, ..., help = NULL, width = NULL)

formRow(...)

Arguments

label

A character string specifying a label for the input or NULL in which case a label is not added.

input

A tag element specifying the input to label.

...

For formGroup, additional named arguments passed as HTML attributes to the parent element.

For formRow, any number of formGroups or additional named arguments passed as HTML attributes to the parent element.

help

A character string specifying help text for the input, defaults to NULL, in which case help text is not added.

width

A responsive argument. One of 1:12, "content", or "equal" specifying a column width for the form group, defaults to NULL.

Details

Getting started

Use responsive arguments to adjust form layouts based on viewport size. Be sure to adjust the size of your browser window between large and small.

card(
  .style %>%
    background("secondary") %>%
    margin(3),
  formRow(
    formGroup(
      width = c(md = 6),  # <-
      label = "Username",
      textInput(
        id = "user"
      )
    ),
    formGroup(
      width = c(md = 6),  # <-
      label = "Password",
      textInput(
        type = "password",
        id = "pass"
      )
    )
  ),
  formGroup(
    label = "Username",
    groupTextInput(
      id = "username",
      left = "@"
    )
  ),
  buttonInput(
    .style %>% background("primary"),
    id = "go",
    label = "Go!"
  )
)
@

nteetor/yonder documentation built on June 8, 2022, 1:36 p.m.