booleantrue
false
Using Grommet for HPE?See Button examples and guidance.
A grommet Button is used for anything that looks like a button on the screen. If an href is provided, it will be rendered in the DOM with <a/>. An Anchor component should be used for inline anchors within textual contexts.
In May 2020, we enhanced Button to have three kinds, outlined below. In order to maintain backwards compatibility, this approach is only available when the theme being used defines button.default.
The majority of Buttons on the page. Their affordance is primarily driven by their context, in a Nav in a Header or Sidebar, the corner of a tile or card, etc.
The primary call to action. There should typically be at most one primary Button on the screen. In a Form context, it signifies the action bound to the enter key that will submit the form.
When there isn’t enough context to indicate its affordance, or when it should call extra attention to itself but isn’t the primary call to action, use a secondary Button. Secondary buttons are only available when the underlying theme being used defines button.default.
string"a user friendly label for screen readers"
string"start"
"center"
"end"
"stretch"
"baseline"
string"div"
function() => {}elementLink
booleantrue
false
element<Box>...</Box>
number10
object
{
background: {
color: "...",
dark: "...",
image: "string",
position: "string",
opacity: "...",
repeat: "...",
size: "...",
light: "string"
}
max: number,
value: "..."
}
"string"
{ dark: "string", light: "string" }boolean
"string"
boolean
number
"weak"
"medium"
"strong"
"no-repeat"
"repeat"
"string"
"cover"
"contain"
"string"
boolean
number
booleantrue
false
function({ disabled, hover, focus }) => {<Box>...</Box>}objectnode<Box>...</Box>
string"control"
object { dark: "string", light: "string" }string"horizontal"
"vertical"
booleantrue
false
string"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
"string"
booleantrue
false
string"background"
object
{
color: "...",
dark: "...",
image: "string",
position: "string",
opacity: "...",
repeat: "...",
size: "...",
light: "string"
}
{
background: {
color: "...",
dark: "...",
image: "string",
position: "string",
opacity: "...",
repeat: "...",
size: "...",
light: "string"
},
elevation: "..."
}
"string"
{ dark: "string", light: "string" }boolean
"string"
boolean
number
"weak"
"medium"
"strong"
"no-repeat"
"repeat"
"string"
"cover"
"contain"
"string"
"none"
"xsmall"
"small"
"medium"
"large"
"xlarge"
"string"
element<Add />
string"around"
"between"
"center"
"end"
"evenly"
"start"
"stretch"
string"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
object
{
vertical: "...",
horizontal: "...",
top: "...",
bottom: "...",
left: "...",
right: "..."
}
busy or success state changes.object{
"busy": "button is in a busy state",
"success": "button action succeeded"
}function() => {}string"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
"any CSS size"
object
{
vertical: "...",
horizontal: "...",
top: "...",
bottom: "...",
left: "...",
right: "...",
start: "...",
end: "..."
}
booleantrue
false
booleantrue
false
booleantrue
false
string"small"
"medium"
"large"
booleantrue
false
string"_self"
"_blank"
"_parent"
"_top"
"string"
string"example tooltip"
object
{
content: node | "string",
dropProps: {...}
plain: boolean
}
At its core, the Button component is a regular <button> 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 button 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"active"
object{ dark: "string", light: "string" }string"medium"
number0.5
string"black"
object{ dark: "white", light: "black" }string"active"
object{ color: "active", opacity: "medium" }string"black"
object{ dark: "white", light: "black" }string"brand"
object{ dark: "white", light: "brand" }string"black"
object{ dark: '#f8f8f8', light: '#444444' }object
{
background: "background-contrast",
elevation: "small",
margin: "xsmall",
pad: { vertical: "xsmall", horizontal: "small" },
round: "small"
}
object
{
align: { top: "bottom" },
background: "none",
elevation: "none",
margin: "none"
}
string"focus"
object{ dark: "string", light: "string" }object{
inset: {
border: {
color: 'focus',
},
outline: { color: 'focus', size: '2px', offset: '-2px' },
shadow: undefined,
twoColor: undefined,
},}string"brand"
object{ dark: "string", light: "string" }string"focus"
object{ dark: "string", light: "string" }