Componentnavigation0.33 KB gzipZero dependencies

SkipLink

Accessibility skip-link that becomes visible on keyboard focus with translate animation

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add skip-link

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { SkipLink } from "@/components/ui/skip-link" <SkipLink href="#main" />

Source code

skip-link.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxskip-link.tsx27 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface SkipLinkProps extends React.HTMLAttributes<HTMLElement> {  href: string;  children?: React.ReactNode;} export function SkipLink({  href,  children = "Skip to main content", ...props}: SkipLinkProps) {  return (    <a      href={href}      className={cn(        "sr-only focus:not-sr-only focus:translate-x-0 focus:transition-transform focus:ring-2 focus-visible:ring-ring",        "mx-2 mb-2 rounded-md bg-secondary text-secondary-foreground px-3 py-1 text-[10px] uppercase tracking-[0.15em]",        "motion-safe:animate-[fade-in-up_0.3s_ease-out_both]"      )} {...props}    >      {children}    </a>  );}

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { SkipLink } from "@/components/ui/skip-link"; <SkipLink />
PropTypeDescription
hrefstringDestination URL rendered as a link target.
childrenReact.ReactNodeChild elements rendered inside the component. (Default: "Skip to main content")