Navigation
SkipLink
Free10.1 KB gzippedBypass link (WCAG 2.4.1) that stays visually hidden until it receives keyboard focus, then springs in as a high-contrast pill at the top start corner of the viewport, above every other layer. Render it as the first focusable element on the page.
Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Tab, Enter · Full report
Import
import { SkipLink, SkipLinks } from "@vjdesigns/vjdesigns-ui";
Importing only SkipLink adds about 10.1 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.
Examples
Basic
Hidden until it receives keyboard focus, then shown above everything. Put it first in the page so keyboard users can jump past the header. Click in this box, then press Tab to see it.
Click here, then press Tab.
import { Box, SkipLink, Text } from "@vjdesigns/vjdesigns-ui";
export function Basic() {
return (
<Box tabIndex={-1} p={6} border radius="lg" style={{ width: "100%", maxWidth: "28rem" }}>
<SkipLink href="#api">Skip to the API reference</SkipLink>
<Text tone="muted">Click here, then press Tab.</Text>
</Box>
);
}
Several
SkipLinks groups several targets, such as the main content and the search.
Click here, then press Tab, and Tab again.
import { Box, SkipLink, SkipLinks, Text } from "@vjdesigns/vjdesigns-ui";
export function Several() {
return (
<Box tabIndex={-1} p={6} border radius="lg" style={{ width: "100%", maxWidth: "28rem" }}>
<SkipLinks aria-label="Skip links">
<SkipLink href="#examples">Skip to examples</SkipLink>
<SkipLink href="#api">Skip to the API reference</SkipLink>
</SkipLinks>
<Text tone="muted">Click here, then press Tab, and Tab again.</Text>
</Box>
);
}
Accessibility
Press Tab inside the preview: the skip link appears when it gets focus. Activating it moves focus to the target (adding a temporary tabindex="-1" when the target isn't focusable), so the next Tab continues from there instead of from the top of the page.
import { Box, SkipLink, Text } from "@vjdesigns/vjdesigns-ui";
export function Accessibility() {
return (
<Box border radius="lg" p={4} style={{ width: "100%", position: "relative" }}>
<SkipLink href="#a11y-skip-target">Skip to results</SkipLink>
<Text tone="muted">Filters, sorting and other controls would be here.</Text>
<Box id="a11y-skip-target" mt={4} p={3} border radius="md">
<Text weight="semibold">Results start here.</Text>
</Box>
</Box>
);
}
Translated
Without children, the skip link's text comes from the locale (Spanish here). Press Tab inside the preview to see it.
import { Box, SkipLink, Text, LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import es from "@vjdesigns/vjdesigns-ui/locales/es";
export function Translated() {
return (
<LocaleProvider locale="es" messages={es}>
<Box border radius="lg" p={4} style={{ width: "100%", position: "relative" }}>
<SkipLink href="#translated-skip-target" />
<Text tone="muted">Menú y filtros.</Text>
<Box id="translated-skip-target" mt={4} p={3} border radius="md">
<Text weight="semibold">Contenido principal.</Text>
</Box>
</Box>
</LocaleProvider>
);
}
Right to left
The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.
Basic
Click here, then press Tab.
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";
// Basic is the "Basic" example above.
<LocaleProvider locale="ar" messages={ar}>
<Basic />
</LocaleProvider>
Usage notes
With a sticky header, give the target a scroll-margin-top of at least the header's height (WCAG 2.4.11), so it isn't scrolled under the header.
Note: the target receives programmatic focus, so browsers may draw a focus ring around it (e.g. the whole <main>). That ring tells keyboard users where they landed; if you want to hide it, style [tabindex="-1"]:focus on the target rather than removing focus.
API reference
SkipLink
| Prop | Type | Default |
|---|---|---|
hrefSame-page fragment of the element to skip to, such as | string | — |
childrenLink text. Defaults to "Skip to main content". | ReactNode | — |
Also accepts native <a> attributes, plus className, style and ref.
SkipLinks
Groups several skip links (for example navigation, search, and main content) as a list. Only the focused link is visible; Tab moves through them in order. Pass an aria-label (such as "Skip links") to name the list.
| Prop | Type | Default |
|---|---|---|
children
| ReactNode | — |
Also accepts native <ul> attributes, plus className, style and ref.
See what changed in each version in the Changelog.
Accessibility report
SkipLink targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.
axe-core audit (live)
Checking the examples above…
Lighthouse audit
Light mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Dark mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.
Built-in behavior
Keyboard
| Key | Action |
|---|---|
| Tab | The first Tab on the page shows the link. |
| Enter | Moves focus to the target (for example #main). |
Roles and states
| Element | Role | States and properties |
|---|---|---|
<a> | link | — |
SkipLinks | list | aria-label |
Manual checks
Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.
| Check | What to test | WCAG 2.2 |
|---|---|---|
| Keyboard | Every action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck. | 2.1.1 (A), 2.1.2 (A) |
| Focus | Focus moves in a logical order, is always visible, and isn't hidden behind sticky headers. | 2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA) |
| Screen readers | Names, roles and states are announced correctly, and status changes are announced without moving focus. | 1.3.1 (A), 4.1.2 (A), 4.1.3 (AA) |
| Color | Meaning never depends on color alone; your own colors meet contrast in both modes. | 1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA) |
| Zoom and reflow | At 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed. | 1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA) |
| Pointer targets | Click and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap. | 2.5.8 (AA), 2.5.5 (AAA) |
| Motion | Animations respect the reduced-motion setting. | 2.3.3 (AAA) |