npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mks2508/mobile-bottom-nav

v4.0.0

Published

Production-ready mobile bottom navigation for Next.js with advanced viewport handling

Readme

@mks/mobile-bottom-nav

Production-ready mobile bottom navigation component for Next.js with advanced viewport handling, SSR support, and complete TypeScript integration.

Features

  • 🚀 Next.js Optimized: Full SSR/CSR support with Next.js Link and Image
  • 📱 Advanced Viewport Handling: Supports 100dvh, 100svh, 100lvh with fallbacks
  • 🎨 Tailwind CSS: 95% utility classes, minimal custom CSS
  • 🔧 TypeScript: Complete type safety and IntelliSense
  • Accessible: WCAG compliant with ARIA attributes
  • 🎯 Platform Detection: iOS/Android specific optimizations
  • 🛡️ Safe Area Support: Respects device notches and home indicators
  • 🖼️ Flexible Icons: Support for React components or Next/Image
  • 🎭 Multiple Variants: Default, floating, and minimal styles
  • 📦 Lightweight: ~8KB minified + gzipped

Installation

npm install @mks/mobile-bottom-nav
# or
yarn add @mks/mobile-bottom-nav
# or
bun add @mks/mobile-bottom-nav

Quick Start

import { MobileBottomNav } from '@mks/mobile-bottom-nav'
import '@mks/mobile-bottom-nav/styles' // Critical CSS (~1KB)
import { Home, Search, Plus, Heart, User } from 'lucide-react'

const navItems = [
  { 
    name: 'Home', 
    href: '/', 
    icon: Home,
    alt: 'Go to homepage'
  },
  { 
    name: 'Search', 
    href: '/search', 
    icon: Search 
  },
  { 
    name: 'Create', 
    href: '/create', 
    icon: Plus,
    badge: '3' // Optional badge
  },
  { 
    name: 'Favorites', 
    href: '/likes', 
    icon: Heart 
  },
  { 
    name: 'Profile', 
    href: '/profile', 
    icon: User 
  }
]

export default function Layout({ children }) {
  return (
    <>
      {children}
      <MobileBottomNav 
        items={navItems}
        variant="default"
        showLabels={true}
        iconSize="md"
      />
    </>
  )
}

Advanced Usage

With Next/Image

const navItems = [
  {
    name: 'Dashboard',
    href: '/dashboard',
    image: {
      src: '/icons/dashboard.svg',
      alt: 'Dashboard icon',
      width: 24,
      height: 24
    }
  },
  // Mix icons and images
  {
    name: 'Settings',
    href: '/settings',
    icon: Settings // Lucide icon
  }
]

Floating Variant

<MobileBottomNav 
  items={navItems}
  variant="floating" // Adds margin and rounded corners
  className="shadow-2xl" // Additional styling
/>

Controlled Active State

function MyApp() {
  const [activeIndex, setActiveIndex] = useState(0)
  
  return (
    <MobileBottomNav 
      items={navItems}
      activeIndex={activeIndex}
      onNavigate={(item, index) => {
        console.log('Navigating to:', item.href)
        setActiveIndex(index)
      }}
    />
  )
}

Custom Active Indicator

<MobileBottomNav 
  items={navItems}
  showActiveIndicator={true}
  activeIndicator={
    <div className="absolute -bottom-1 w-8 h-1 bg-gradient-to-r from-blue-500 to-purple-500 rounded-full" />
  }
/>

External Links

const navItems = [
  {
    name: 'Documentation',
    href: 'https://docs.example.com',
    icon: Book,
    useNextLink: false // Forces regular anchor tag
  }
]

Props

MobileBottomNavProps

| Prop | Type | Default | Description | |------|------|---------|-------------| | items | NavItemConfig[] | Required | Navigation items configuration | | className | string | - | Additional container classes | | activeIndex | number | - | Controlled active item index | | onNavigate | (item, index) => void | - | Navigation callback | | debug | boolean | false | Show debug information | | variant | 'default' \| 'floating' \| 'minimal' | 'default' | Visual style variant | | showLabels | boolean | true | Show text labels | | iconSize | 'sm' \| 'md' \| 'lg' | 'md' | Icon size | | showActiveIndicator | boolean | false | Show active indicator | | activeIndicator | ReactNode | - | Custom active indicator | | sticky | boolean | true | Use sticky positioning | | zIndex | number | 40 | Z-index value |

NavItemConfig

| Prop | Type | Description | |------|------|-------------| | name | string | Display text | | href | string | Navigation URL | | alt | string | Accessibility text | | icon | ComponentType | React icon component | | image | object | Next/Image config | | badge | ReactNode | Badge content | | onClick | () => void | Click handler | | className | string | Item classes | | useNextLink | boolean | Force Link usage |

Styling

The component uses Tailwind CSS classes. Ensure your project has Tailwind configured.

Required Tailwind Classes

The component expects these Tailwind utilities:

  • Layout: flex, sticky, fixed, bottom-0
  • Spacing: px-2, py-1, mb-1
  • Colors: bg-background, text-primary, text-muted-foreground
  • Effects: backdrop-blur-md, border, rounded-lg
  • Animations: transition-all, duration-200, active:scale-95

Custom CSS Variables

Add to your global CSS for theming:

:root {
  --navbar-bottom: 0px; /* Set dynamically by component */
}

Browser Support

  • Chrome/Edge 108+ (100dvh support)
  • Safari iOS 15.4+
  • Firefox 101+
  • Samsung Internet 19+

Includes automatic fallbacks for older browsers.

TypeScript

Full TypeScript support with exported types:

import type { 
  NavItemConfig, 
  MobileBottomNavProps,
  NavVariant,
  IconSize 
} from '@mks/mobile-bottom-nav'

Performance

  • Lazy loads images with Next/Image
  • Uses React.memo for items
  • Throttled viewport listeners (60fps)
  • CSS containment for reflow optimization
  • Touch-optimized with touch-action: manipulation

Accessibility

  • Semantic HTML with <nav> element
  • ARIA labels and current page indication
  • Keyboard navigation support
  • Focus indicators
  • Screen reader friendly

License

MIT

Author

MKS2508