packages/grafana-ui/src/components/Link/TextLink.mdx
import { Meta, Canvas, ArgTypes } from '@storybook/blocks'; import { TextLink } from './TextLink'; import * as TextLinkStories from './TextLink.story.tsx'; import { ExampleFrame } from '../../utils/storybook/ExampleFrame';
<Meta title="MDX|TextLink" component={TextLink} />The TextLink component renders an anchor tag <a> that takes users to another page, external or internal to Grafana.
In this documentation you can find:
4.1. Inline
4.2. Standalone
4.3. Icons
Within Grafana, there are two different types of text links, 'inline' or 'standalone', whether they are wrapped by text or being a standalone element.
Both inline or standalone text links will redirect the user to a specific page, therefore, depending on this they can be internal or external.
The following is the default behaviour and so, it will be applied according to its type.
Example: We should take into account that through the color prop the user will be able to change this value, but the rest will be kept. So, in this example, if the user renders an external and standalone text link setting the color value to 'primary' the result will be a text link 'white' in dark theme or 'black' in light theme, as set by the user, and not underlined at first while blue and underlined when onhover, as it inherits from the standalone default behaviour.
<ExampleFrame> <TextLink href="https://google.es" color="primary" inline={false} external> {'This an external standalone link example'} </TextLink> </ExampleFrame>By default, external text links will show an external-alt-icon. If by design reasons, the user needs to set another icon it can be done through the correspondent prop.
Both, external and internal links can show a specific icon using the icon prop.
Links to related components: