Skip to main content

What are you looking for?

Try searching for…

Components

Skip link

Skip link helps people using keyboard navigation to navigate, so they can easily go to the main content on a page.

HTML

Press Enter to start editing
Unable to parse html
const PreviewEn = () => {
  return (
    <>
      <Paragraph>
        To reveal the skip link, tab into this example, or click inside the
        example and press <kbd>Tab</kbd>.
        <SkipLink href='#main-content'>Skip to main content</SkipLink>
      </Paragraph>
      <main id='main-content' tabIndex={-1}>
        Region that can receive focus from the skip link.
      </main>
    </>
  );
};

render(<PreviewEn />)

Usage

Add the class name ds-skip-link to an <a> tag that points to the main content of the page. The target should be able to receive focus with tabindex="-1".

CSS variables and data attributes

Sizes are controlled with data-size and colors with data-color. The component will inherit from the closest parent where these are set.

CSS Variables
NameValue
--dsc-skiplink-paddingvar(--ds-size-4) var(--ds-size-4) var(--ds-size-5) var(--ds-size-4)
--dsc-skiplink-backgroundvar(--ds-color-surface-hover)
--dsc-skiplink-colorvar(--ds-color-text-default)

No relevant data attributes found.

React

children
Description

The content to display inside the skiplink.

Type
ReactNode
href
Description

Href of an element in the DOM the skiplink should skip to. E.g #main-content

Type
string
NameTypeDefaultDescription
childrenReactNode-

The content to display inside the skiplink.

hrefstring-

Href of an element in the DOM the skiplink should skip to. E.g #main-content

Edit this page on github.com (opens in a new tab)