Input
Description
An <input> carrying the Basecoat input class, optionally wrapped with a label in a field.
Usage
bc_input(
...,
label = NULL,
id = NULL,
type = "text",
placeholder = NULL,
description = NULL,
value = NULL,
name = id,
required = FALSE,
disabled = FALSE,
invalid = FALSE,
aria_label = NULL
)
Arguments
| Argument | Description |
|---|---|
... |
Tag attributes for the <input>. |
label |
String or tag. The label content. |
id |
String. The input id, required when a label is given. |
type |
String. The type attribute, "text" by default. |
placeholder |
String. Placeholder text. |
description |
String or tag. Helper text shown under the input, wired to it with aria-describedby. |
value |
String. The initial value. |
name |
String. The input name, defaulting to id. |
required |
Bool. Whether the input is required. |
disabled |
Bool. Whether the input is disabled. |
invalid |
Bool. Whether to show the invalid state. |
aria_label |
String. Accessible name, for an input with no visible label. A placeholder alone is not one. |
Value
An <input> tag or, with a label, a <div> tag.
Examples
bc_input(type = "email", placeholder = "Email", aria_label = "Email")
bc_input(
id = "email",
label = "Email",
type = "email",
placeholder = "m@example.com",
description = "Enter your email address."
)
Enter your email address.