Back to Shark UI

Skip Nav

docs/components/skip-nav

latest5.7 KB
Original Source

Sections

Components

Utilities

Forms

Hooks

Skip Nav

Copy Markdown

Lets keyboard users skip to main content.

PreviewCode

Skip to content

Main Content

This is the main content area. When users press Tab and then Enter on the skip link, focus jumps here.

Click on the "Preview" tab and use the tab key to see the skip to content link.

Installation#

CLIManual

pnpmbunnpmyarn

pnpm dlx shadcn@latest add @shark/skip-nav

Usage#

  • Place SkipNavLink as one of the first focusable elements on the page.
  • Use SkipNavContent to wrap your main content. It renders a div with an id that the link targets.
import { SkipNavContent, SkipNavLink } from "@/components/ui/skip-nav";
<SkipNavLink />
<nav>...</nav>
<SkipNavContent />
<main>Your main content</main>

API Reference#

PropTypeDefault
idstring"skip-nav-content"
classNamestring-
asChildbooleanfalse

SkipNavContent#

PropTypeDefault
idstring"skip-nav-content"
classNamestring-
asChildbooleanfalse

[

Previous page

Skeleton ](/docs/components/skeleton)[

Next page

Slider ](/docs/components/slider)

On This Page

InstallationUsageAPI ReferenceSkipNavLinkSkipNavContent