Use a primary button to call attention to a form submission or to highlight the
most important call to action on a page. Primary buttons should only appear once per area, but not
every screen needs a primary button.
Set isDisabled to disable a button that shouldn't be actionable. The button will appear faded and
won't respond to user interaction.
Disabled buttons can cause accessibility issues (disabled elements are not in the tab order) so
wherever possible, avoid using isDisabled. Instead, use validation or
other techniques to show users how to proceed.
When a button is still loading and not actionable, a loading spinner can be displayed in place of
the button label. This also disables the button and blocks user interaction.
Buttons can expand to full width to fill the parent container. This is sometimes done in login
forms. Follow the alignment guidance for more
options.
Dark theme
import React from 'react';
import Button from '@atlaskit/button/new';
const ButtonFullWidthExample = () => {
return (
<Button shouldFitContainer appearance="primary">
Full width button
</Button>
);
};
export default ButtonFullWidthExample;
Button with icon
Buttons may include an icon before or after the text label. For an icon-only button, see
icon button.
Icon before
Display an icon before the text.
Dark theme
import React from 'react';
import Button from '@atlaskit/button/new';
import StarFilledIcon from '@atlaskit/icon/glyph/star-filled';
const ButtonIconBeforeExample = () => {
return (
<Button iconBefore={StarFilledIcon} appearance="primary">
Icon before
</Button>
);
};
export default ButtonIconBeforeExample;
Icon after
Display an icon after the text.
Dark theme
import React from 'react';
import Button from '@atlaskit/button/new';
import StarFilledIcon from '@atlaskit/icon/glyph/star-filled';
const ButtonIconAfterExample = () => {
return (
<Button iconAfter={StarFilledIcon} appearance="primary">
Icon after
</Button>
);
};
export default ButtonIconAfterExample;
Overriding icon props
Use the iconBefore or iconAfter render prop to override the default icon props.
Dark theme
import React from 'react';
import Button from '@atlaskit/button/new';
import LinkIcon from '@atlaskit/icon/glyph/link';
const ButtonIconBeforeSizeExample = () => {
return (
<Button
iconBefore={(iconProps) => <LinkIcon {...iconProps} size="small" />}
appearance="warning"
>
Icon with size override
</Button>
);
};
export default ButtonIconBeforeSizeExample;
Truncation
Avoid truncation whenever possible. Make sure there's always a way to access the full content for
all users.
Text will truncate when buttons are in a narrow container to prevent wrapping onto a new line and
breaking layouts. An ellipsis will be added to the end to indicate that the text has been truncated.
The truncation is implemented with styles, so screen readers will still read the full text.