Field
Description
A single form control wrapped with its label and helper text.
Usage
bc_field(..., orientation = "default", disabled = FALSE, invalid = FALSE)
bc_fieldset(..., legend = NULL, description = NULL)
bc_field_group(..., aria_label = NULL)
bc_field_separator()
Arguments
| Argument | Description |
|---|---|
... |
Tag attributes and children for the <div>. |
orientation |
String. One of default, horizontal, responsive. default writes no attribute. |
disabled |
Bool. Whether to mark the field as disabled. |
invalid |
Bool. Whether to show the invalid state. |
legend |
String or tag. The group's heading, as a <legend>. |
description |
String or tag. Shown under the legend. |
aria_label |
String. Accessible name for the group. |
Value
A tag.
Details
Children render in order: label, control, helper text. A horizontal field takes the control first.
Examples
bc_field(
htmltools::tags$label(`for` = "username", "Username"),
htmltools::tags$input(id = "username", type = "text"),
htmltools::tags$p("Choose a unique username for your account.")
)
Choose a unique username for your account.
bc_field(
htmltools::tags$input(id = "sync", type = "checkbox", role = "switch"),
htmltools::tags$label(`for` = "sync", "Sync folders"),
orientation = "horizontal"
)
bc_fieldset(
legend = "Address Information",
description = "We need your address to deliver your order.",
bc_field(
htmltools::tags$label(`for` = "street", "Street"),
htmltools::tags$input(id = "street", type = "text")
)
)
bc_field_group(
aria_label = "Account credentials",
bc_field(
htmltools::tags$label(`for` = "email", "Email"),
htmltools::tags$input(id = "email", type = "email")
),
bc_field_separator(),
bc_field(
htmltools::tags$label(`for` = "password", "Password"),
htmltools::tags$input(id = "password", type = "password")
)
)