---
title: SkipLink
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, TokensTable, PropsTable } from '../../src/components'
import { SkipLink, Card, Typography, Button } from '@telus-uds/components-web'
import { SkipLink as BaseDocs } from 'docs/@telus-uds/components-base'
import AvailableOnWebOnly from '../../partials/_platform-considerations-web-only.mdx'
import NoStylisticVariants from '../../partials/_variants-none.mdx'

# SkipLink

<LibraryInfo />

```jsx live
<Box space={2}>
  <SkipLink href="#skip-target">Skip to the first detailed example</SkipLink>
</Box>
```

## Introduction

SkipLinks are links to sections, invisible by default, but focusable using keyboard navigation and visible when focused.

[Follow the appropriate instructions](importing-components) to add this component in to your app.

## Guidance

SkipLinks help keyboard navigation users, screen reader users, and other users dependent on tab order to skip sections and navigate to the content they want.

### At the top of a page

SkipLink is most often used as the first item in a HTML page's `<body>`, linking to the main content section.

This enables users to skip navigation elements and go straight to a page's unique content.

In this example, it enables a user to skip past the nav links, straight to the `<main>` section.

```jsx live
<StackView space={5}>
  <SkipLink href="#skip-target">Skip past the navigation bar</SkipLink>

  <NavigationBar
    heading="Navigation bar"
    items={[
      { label: 'Nav link' },
      { label: 'Nav link' },
      { label: 'Nav link' },
      { label: 'Nav link' }
    ]}
  />
  <StackView tag="main" nativeID="skip-target" space={3}>
    <Typography tag="h2" variant={{ size: 'h2' }}>
      After the navigation links
    </Typography>
    <Typography>This example contains a skip link before the navigation bar.</Typography>
    <Typography>
      Use the 'tab' key to tab through focusable items. The skip link becomes visible when focused.
    </Typography>
    <Typography>
      Using it skips past the navigation bar links, helping a user to more quickly reach other
      content, like this button.
    </Typography>
    <Button>Focusable button</Button>
  </StackView>
</StackView>
```

### Skipping content sections

In some rare cases, a skip link may be useful within a page, to allow users to skip a complex UI widget that contains many focusable elements.

Usually, it is better to rework the page so that such complex widgets are simpler, or, appear only for users who need them (see, for example, [ExpandCollapse](expand-collapse) and [ExpandCollapseMini](expand-collapse-mini)).

However, there may be cases where a complex widget needs to be on display by default, but should be skippable.

```jsx live
<StackView space={4}>
  <SkipLink href="#after-survey">Skip optional survey</SkipLink>
  <Typography tag="h3" variant={{ size: 'h3' }}>
    Optional survey
  </Typography>
  <Typography>Please take a moment to fill in this optional, skippable survey.</Typography>
  <ButtonGroup
    legend="Your mood"
    hint="How are you feeling?"
    tooltip="Moods are temporary emotional states, experienced by most humans"
    items={[{ label: 'Good' }, { label: 'Great' }, { label: 'Fantastic!' }, { label: 'Other' }]}
  />
  <ButtonGroup
    legend="This survey"
    hint="How do you like this survey?"
    tooltip="This survey is a survey about feelings about surveys"
    items={[{ label: 'Good' }, { label: 'Great' }, { label: 'Fantastic!' }, { label: 'Other' }]}
  />
  <Typography>This survey is not a good example of good user experience.</Typography>
  <Button>Save your answers</Button>
  <Divider />
  <Typography tag="h3" variant={{ size: 'h3' }} block nativeID="after-survey">
    Important information
  </Typography>
  <Typography>Important content continues here.</Typography>
  <Typography>Users not interested in the survey may use the skip link to jump to here.</Typography>
  <ChevronLink>Important link</ChevronLink>
  <Typography>
    Without the skip link, they would need to tab through many different controls to get here.
  </Typography>
  <Typography>
    For a better user experience, the survey might be inside an appropriately labelled
    ExpandCollapseMini.
  </Typography>
  <Typography>
    However, this may reduce response rates. A skip link may be a necessary compromise.
  </Typography>
</StackView>
```

### Accessibility

SkipLink supports common accessibility and link props.

### Platform considerations

<AvailableOnWebOnly />

## Props

<PropsTable base={BaseDocs} />

## Tokens

<TokensTable base={BaseDocs} component="SkipLink" />

## Variants

<NoStylisticVariants />

## Feedback

<Feedback component="SkipLink" />
