string"a user friendly label for screen readers"
The component to insert in the FormField. Grommet will update the form values when this field changes. Any additional properties (such as initial value) you pass to FormField will be forwarded to this component. The component may be custom as long it supports the properties of name, value, onChange (event => {}), while event has either event.value or event.target.value.
objectTextArea
functionprops => <input {...props} />object{}string"Text to call attention to an issue with this field"
node{<Box>...</Box>}string"Text to help the user know what is possible"
node<Box>...</Box>
string"input-id"
If input is Select or SelectMultiple: "input-id__input"
string"Additional information to give the user better context of the FormField."
node<Box>...</Box>
string"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
object
{
vertical: "...",
horizontal: "...",
top: "...",
bottom: "...",
left: "...",
right: "..."
}
string"name"
formField.requiredIndicator = true in your theme, passing indicator: false will not display the required indicator for the given field.booleantrue
false
objectrequired={{ indicator: false }}objectAn object with max and (optionally) threshold can be used to implement a character counter.
{
regexp: regular expression,
message: "string" | node,
status: "error" | "info"
}
{
max: number,
threshold: number,
}
function() => {}array
[
{
regexp: regular expression,
message: "string" | node,
status: "error" | "info"
},
function
]
At its core, the FormField component is a regular <div> element. Thus, both DOM and React properties, methods, and events are accessible. To read up on all of the possible DOM attributes and types available for div elements, check out this MDN Web Documents page. To learn more about DOM events and methods, you can read more on the MDN Web Events documentation page.
Also, feel free to read about the types of React events available, or see how DOM attributes change in React. Working in tandem with Styled Components, you also have access to the as property.
string"border"
object{ dark: "string", light: "string" }string"status-critical"
object{ dark: 'white', light: 'status-critical' }string"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
"any CSS size"
object
{
vertical: "...",
horizontal: "...",
top: "...",
bottom: "...",
left: "...",
right: "...",
start: "...",
end: "..."
}
string"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
object
{
vertical: "...",
horizontal: "...",
top: "...",
bottom: "...",
left: "...",
right: "..."
}
string"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
"any CSS size"
object
{
vertical: "...",
horizontal: "...",
top: "...",
bottom: "...",
left: "...",
right: "...",
start: "...",
end: "..."
}
string"brand"
object{ dark: "string", light: "string" }booleantrue
false
string"medium"
number0.5
string"brand"
object{ dark: "string", light: "string" }string"brand"
object{ dark: "string", light: "string" }string"brand"
object{ dark: "string", light: "string" }string"brand"
object{ dark: "string", light: "string" }string"brand"
object{ dark: "string", light: "string" }booleantrue
false
string"medium"
number0.5
string"status-critical"
object{ dark: "white", light: "status-critical" },string"status-critical"
object{ dark: "string", light: "string" },object{}object{}string"small"
object{ vertical: "xsmall", horizontal: "small" }string"brand"
object{ dark: "string", light: "string" }string"brand"
object{ dark: "string", light: "string" }booleantrue
false
stringcss`color: 'blue'`
function(props) => {}stringcss`color: 'blue'`
function(props) => {}string"dark-3"
object{ dark: "dark-3", light: "dark-3" }kind label.object
{
size: 'large',
color: 'black',
margin: {
vertical: "xsmall",
}
}
string"text-xweak"
object{ dark: "string", light: "string" },string"small"
object{ vertical: "xsmall", horizontal: "small" }object
{
margin: {
vertical: "xsmall",
horizontal: "small"
}
}
string"small"
object{ vertical: "xsmall", horizontal: "small" }booleantrue
false
element<Box a11yTitle="required">...</Box>
string"required"
booleantrue
false
string"xsmall"
"small"
"medium"
"large"
"xlarge"
"full"
"any CSS size"
object{ size: "...", corner: "..." }"top"
"left"
"bottom"
"right"
"top-left"
"top-right"
"bottom-left"
"bottom-right"