Skip link

Skip link component is a web component that displays a link to the main content of the page. It is used to skip the navigation and go directly to the main content.

Design system docs Examples Default skip link

Click on the live code block and hit tab to see the skip link in action.

<dap-ds-skip-link>
Skip to main content
</dap-ds-skip-link>
Importing
import { DapDSSkipLink } from 'dap-design-system'
Importing React
import { DapDSSkipLinkReact } from 'dap-design-system/react'
Tree-Shakeable Imports

For optimal bundle sizes, use the tree-shakeable import syntax:

import { DapDSSkipLink } from 'dap-design-system/components'
Attributes
PropertyTypeDefaultDescription
placement'left', 'center'The placement of the skip link.
hrefstring'#'The href of the skip link
size'sm', 'lg''sm'The size of the skip link
noUnderlinebooleanfalseWhether the skip link should have an underline
Slots
NameDescription
(default)The content of the skip link.
Events

No custom events available.

CSS Parts
Part NameDescription
baseThe main skip link container.
textThe text container of the skip link.
high-contrastThe high contrast outline container.
How to Use CSS Parts

You can style CSS parts using the ::part() pseudo-element selector:

/* Target a specific part */
.my-custom-dap-ds-skip-link::part(base) {
  /* Your custom styles */
}

/* Target multiple parts */
.my-custom-dap-ds-skip-link::part(base),
.my-custom-dap-ds-skip-link::part(text) {
  /* Shared styles */
}

Example usage:

<dap-ds-skip-link class="my-custom-dap-ds-skip-link">
  Skip link
</dap-ds-skip-link>
.my-custom-dap-ds-skip-link::part(base) {
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

CSS parts allow you to style internal elements of the component while maintaining encapsulation. Learn more in our styling guide.

CSS Custom Properties
Property NameDescription
--dds-skip-link-border-colorBorder color for the high contrast outline (default: var(--dds-border-neutral-transparent-interactive, #fff500))
--dds-skip-link-border-widthBorder width for the high contrast outline (default: var(--dds-border-width-large))
--dds-skip-link-border-width-activeBorder width for the active state (default: var(--dds-border-width-xlarge))
--dds-skip-link-border-radiusBorder radius of the skip link (default: var(--dds-radius-small))
--dds-skip-link-padding-smPadding for small size variant (default: var(--dds-spacing-200))
--dds-skip-link-padding-lgPadding for large size variant (default: var(--dds-spacing-400))
--dds-skip-link-text-underline-offsetUnderline offset for the text (default: 3px)
--dds-skip-link-z-indexZ-index of the skip link (default: var(--dds-z-index-100))
How to Use CSS Custom Properties

CSS custom properties (CSS variables) can be set directly on the component or in your stylesheet:

Method 1: Inline styles (Quick customization)

<dap-ds-skip-link
  style="--dds-skip-link-border-color: value; --dds-skip-link-border-width: value;">
  Skip link
</dap-ds-skip-link>

Method 2: CSS classes (Reusable styles)

.my-custom-dap-ds-skip-link {
  --dds-skip-link-border-color: value;
  --dds-skip-link-border-width: value;
  --dds-skip-link-border-width-active: value;
}
<dap-ds-skip-link class="my-custom-dap-ds-skip-link">
  Skip link
</dap-ds-skip-link>

Method 3: Global theme customization

/* Apply to all instances */
dap-ds-skip-link {
  --dds-skip-link-border-color: value;
  --dds-skip-link-border-width: value;
}

CSS custom properties inherit through the Shadow DOM, making them perfect for theming. Changes apply immediately without rebuilding.