Componentnavigation0.33 KB gzipZero dependencies
SkipLink
Accessibility skip-link that becomes visible on keyboard focus with translate animation
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add skip-linkOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { SkipLink } from "@/components/ui/skip-link" <SkipLink href="#main" />Source code
skip-link.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| href | string | Destination URL rendered as a link target. |
| children | React.ReactNode | Child elements rendered inside the component. (Default: "Skip to main content") |