import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'; import { ButtonLink } from './button-link'; import { ButtonBase } from '../button-base'; # ButtonLink The `ButtonLink` is an extension of `ButtonBase` to support link styles ## Props ### Size Use the `size` prop and the `ButtonLinkSize` enum from `./ui/components/component-library` to change the size of `ButtonLink`. Defaults to `ButtonLinkSize.Auto` Possible sizes include: - `ButtonLinkSize.Auto` sets the height to auto but retains `ButtonLink` font-size - `ButtonLinkSize.Sm` 32px - `ButtonLinkSize.Md` 40px - `ButtonLinkSize.Lg` 48px - `ButtonLinkSize.Inherit` inherits the font-size of the parent element. Used for inline links in paragraphs. ```jsx import { ButtonLink, ButtonLinkSize, Text, TextVariant } from '../../component-library'; Auto (default) Small Medium Large Inherits the font-size of the parent element. Learn more Inherits the font-size of the parent element. Learn more Inherits the font-size of the parent element. Learn more Inherits the font-size of the parent element and example with override for a success color. Learn more ``` ### Danger Use the `danger` boolean prop to change the `ButtonLink` to danger color. ```jsx import { ButtonLink } from '../../component-library'; Normal Danger ``` ### Href When an `href` prop is passed it will change the element to an anchor(`a`) tag. ```jsx import { ButtonLink } from '../../component-library'; Href example; ``` ### External Link When an `externalLink` prop is passed it adds the `target="_blank"` and `rel="noopener noreferrer"` attributes. `rel="noreferrer noopener"` is used in links to prevent security vulnerabilities that can be exploited by malicious websites. It disables the window.opener property and prevents the new page from sending the referrer information, providing an additional layer of security. ```jsx import { ButtonLink } from '../../component-library'; Anchor element with external link ; ``` ### Hit area The default hit area for `ButtonLink` is the width of the text and height based on the `size` prop which is set to `ButtonLinkSize.Auto` by default. There may be times when you want to increase the hit area of the `ButtonLink`. To do this you can use the `Box` props `paddingLeft` and `paddingRight`. Or alternatively you can use the `block` prop which sets the width to 100%. ```jsx import { ButtonLink, ButtonLinkSize } from '../../component-library'; Auto (default) Small Medium Large Large block ```