import { ArgTypes, Canvas, Story, Meta } from '@storybook/addon-docs/blocks';
import * as LinkStories from './Link.stories';
import { stackblitzPrefillConfig } from '../../../previewer/codePreviewer';

<Meta isTemplate />

# Link

[Source code](https://github.com/carbon-design-system/carbon/tree/main/packages/react/src/components/Link)
&nbsp;|&nbsp;
[Usage guidelines](https://www.carbondesignsystem.com/components/link/usage)
&nbsp;|&nbsp;
[Accessibility](https://www.carbondesignsystem.com/components/link/accessibility)

{/* <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> */}

## Table of Contents

- [Overview](#overview)
- [Inline](#inline)
- [Accessible Link with Icon](#accessible-link-with-icon)
- [Component API](#component-api)
- [Feedback](#feedback)

{/* <!-- END doctoc generated TOC please keep comment here to allow auto update --> */}

## Overview

Links are used as navigational elements and can be used on their own or inline
with text. They provide a lightweight option for navigation but like other
interactive elements, too many links will clutter a page and make it difficult
for users to identify their next steps. This is especially true for inline
links, which should be used sparingly.

<Canvas
  of={LinkStories.Default}
  additionalActions={[
    {
      title: 'Open in Stackblitz',
      onClick: () => stackblitzPrefillConfig(LinkStories.Default),
    },
  ]}
/>

## Inline

<Canvas
  of={LinkStories.Inline}
  additionalActions={[
    {
      title: 'Open in Stackblitz',
      onClick: () => stackblitzPrefillConfig(LinkStories.Inline),
    },
  ]}
/>

## Accessible Link with Icon

If the text of your link doesn't correspond to the action represented by the
icon, consider incorporating an `aria-label` for the icon. This will ensure that
visually impaired users can comprehend the outcome of clicking the link.

<Canvas
  of={LinkStories.PairedWithIcon}
  additionalActions={[
    {
      title: 'Open in Stackblitz',
      onClick: () => stackblitzPrefillConfig(LinkStories.PairedWithIcon),
    },
  ]}
/>

## Component API

<ArgTypes />

## Feedback

Help us improve this component by providing feedback, asking questions on Slack,
or updating this file on
[GitHub](https://github.com/carbon-design-system/carbon/edit/main/packages/react/src/components/Link/Link.mdx).
