For buttons that are links for navigation rather than on-page actions. Link icon buttons render an
<a> tag instead of a <button>. They accept anchor tag HTML attributes, including href.
When available, link icon button will consume the router link component configured in the app
provider. This allows router links to be configured once across an entire application. (This
replaces the component prop).
These links won't use the configured router link component when passed to href, and instead render
a standard <a> tag:
External links
Non-HTTP-based links (mailto:, tel:, sms:)
Anchor / hash links (#)
If your application doesn't have an existing app provider or routerLinkComponent configuration,
see how to set this up in
the app provider documentation.
Tooltips
Tooltips are currently disabled by default. They will be enabled by default in a later release. Prefer using built-in tooltips over wrapping the link icon button manually.
Set isTooltipDisabled to false to enable the tooltip. The value of label will be used for the
tooltip content.
A primary button calls attention to the most important action on a page or in an area. Primary icon
buttons aren't common because critical actions should typically use
a button with a label for clarity.
import React from 'react';
import LinkIconButton from '@atlaskit/button/icon/link';
import CompassIcon from '@atlaskit/icon/core/compass';
import { token } from '@atlaskit/tokens';
const LinkIconButtonOverridesExample = (): React.JSX.Element => {
return (
<LinkIconButton
href="https://atlassian.com"
appearance="subtle"
icon={(iconProps) => <CompassIcon {...iconProps} color={token('color.icon.discovery')} />}
label="Learn about new features"
/>
);
};
export default LinkIconButtonOverridesExample;
Advanced href usage with TypeScript
Link button accepts a generic type containing the configured router link's props. This is only
required for advanced usage to allow an object to be passed to href.
import React from 'react';
import LinkIconButton from '@atlaskit/button/icon/link';
import PersonAvatarIcon from '@atlaskit/icon/core/person-avatar';
type MyRouterLinkConfig = {
to: string;
replace?: boolean;
};
const LinkIconButtonWithRoutingExample = (): React.JSX.Element => {
return (
<LinkIconButton<MyRouterLinkConfig>
href={{
to: '/profile',
replace: true,
}}
icon={PersonAvatarIcon}
label="View profile"
/>
);
};
export default LinkIconButtonWithRoutingExample;
States
Disabled
The disabled HTML attribute does not exist for anchor <a> tags, so link buttons are disabled
using this accessible technique: