Labels give a name or title to a control or group of controls, including text fields, check boxes, combo boxes, radio buttons, and drop-down menus.

For more details and examples visit the official docs. The R package can not handle each and every case, so for advanced use cases you need to work using the original docs to achieve the desired result.

Label(...)

Arguments

as

IComponentAs<React.AllHTMLAttributes<HTMLElement>>
Render the root element as another type.

componentRef

IRefObject<ILabel>
Optional callback to access the ILabel interface. Use this instead of ref for accessing the public methods and properties of the component.

disabled

boolean
Renders the label as disabled.

required

boolean
Whether the associated form field is required or not

styles

IStyleFunctionOrObject<ILabelStyleProps, ILabelStyles>
Styles for the label.

theme

ITheme
Theme provided by HOC.

Best practices

Layout

  • Labels should be close to the control they're paired with.

Content

  • Labels should describe the purpose of the control.

  • Use sentence-style capitalization—only capitalize the first word. For more info, see Capitalization in the Microsoft Writing Style Guide.

  • Be short and concise.

  • Use nouns or short noun phrases.

  • Don't use labels as instructional text. For example, "Click to get started".

Examples

library(shiny.fluent)

if (interactive()) {
  shinyApp(
    ui = Label("Required label", required = TRUE),
    server = function(input, output) {}
  )
}