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

@liaplus/voice-navigation-ai

v1.0.1

Published

AI-powered voice navigation component for Next.js with OpenAI integration

Downloads

21

Readme

🎤 Voice Navigation AI

An AI-powered voice navigation component for Next.js applications with OpenAI integration. Provides hands-free website navigation with speech recognition and natural language processing.

npm version License: MIT

✨ Features

  • 🎯 AI-Powered Commands - Natural language understanding with OpenAI
  • 🗣️ Speech Recognition - Built-in Web Speech API support
  • 📱 Fully Responsive - Optimized for mobile, tablet, and desktop
  • Easy Integration - Drop-in component for Next.js 13+
  • 🎨 Customizable - Extend with custom commands and styling
  • Accessible - WCAG compliant with ARIA labels
  • 🌐 Multi-Language - Support for multiple languages (configurable)
  • 🔧 Type Safe - Full TypeScript support

📦 Installation

npm install @liaplus/voice-navigation-ai

Peer Dependencies

Make sure you have the required peer dependencies installed:

npm install next react react-dom

Additional Dependencies

The package also requires these dependencies (automatically installed):

npm install lucide-react class-variance-authority clsx tailwind-merge

🚀 Quick Start

1. Add the Component to Your Layout

// app/layout.tsx
import { VoiceNavigationAdvanced } from '@liaplus/voice-navigation-ai'

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <VoiceNavigationAdvanced />
      </body>
    </html>
  )
}

2. Create the API Route

Create a new file at app/api/voice-command/route.ts:

// app/api/voice-command/route.ts
export { POST } from '@liaplus/voice-navigation-ai/api'

3. Set Environment Variable

Add your OpenAI API key to .env.local:

OPENAI_API_KEY=sk-your-openai-api-key-here

That's it! 🎉 Your voice navigation is now active.

📖 Detailed Setup

Custom API Handler

If you need more control over the API handler:

// app/api/voice-command/route.ts
import { createVoiceCommandHandler } from '@liaplus/voice-navigation-ai/api'

export const POST = createVoiceCommandHandler({
  openaiApiKey: process.env.OPENAI_API_KEY,
  model: 'gpt-4o-mini', // or 'gpt-4'
  systemPrompt: `Your custom system prompt here...`
})

Custom Commands

Extend the default commands with your own:

import { VoiceNavigationAdvanced } from '@liaplus/voice-navigation-ai'

export default function Layout({ children }) {
  return (
    <>
      {children}
      <VoiceNavigationAdvanced
        customCommands={{
          'dashboard': {
            keywords: ['dashboard', 'go to dashboard', 'show dashboard'],
            action: '/dashboard', // String path for navigation
            description: 'Go to dashboard',
            category: 'navigation'
          },
          'logout': {
            keywords: ['logout', 'sign out', 'log out'],
            action: () => {
              // Custom function
              signOut()
            },
            description: 'Sign out',
            category: 'system'
          }
        }}
      />
    </>
  )
}

Component Props

interface VoiceNavigationProps {
  /**
   * Custom command mappings to extend or override default commands
   */
  customCommands?: Record<string, {
    keywords: string[]
    action: string | (() => void)
    description: string
    category: 'navigation' | 'scrolling' | 'content' | 'system' | 'products' | 'resources' | 'solutions' | 'info'
  }>
  
  /**
   * API endpoint for AI-powered voice command processing
   * @default '/api/voice-command'
   */
  apiEndpoint?: string
  
  /**
   * Enable AI mode by default
   * @default false
   */
  defaultAIMode?: boolean
  
  /**
   * Enable voice feedback by default
   * @default true
   */
  defaultVoiceFeedback?: boolean
  
  /**
   * Show commands list by default
   * @default true
   */
  defaultShowCommands?: boolean
}

🎮 Default Commands

📜 Scrolling

  • "scroll up" / "move up" / "go up"
  • "scroll down" / "move down" / "go down"
  • "go to top" / "top of page"
  • "go to bottom" / "bottom of page"
  • "go to middle" / "center"

🧭 Navigation

  • "go home" / "home page"
  • "show products" / "products page"
  • "show pricing" / "pricing page"
  • "about us" / "about page"
  • "contact us" / "contact page"
  • "solutions page"

🔧 System

  • "go back" / "back"
  • "print page" / "print"
  • "hide commands" / "show commands"
  • "scroll commands up" / "scroll commands down"

📖 Content

  • "read page" / "read content"
  • "stop reading" / "stop"

ℹ️ Info

  • "help" / "show commands"

🎨 Styling

The component uses Tailwind CSS classes. Make sure your tailwind.config.js includes the package:

// tailwind.config.js
module.exports = {
  content: [
    './app/**/*.{js,ts,jsx,tsx,mdx}',
    './components/**/*.{js,ts,jsx,tsx,mdx}',
    './node_modules/@liaplus/voice-navigation-ai/**/*.{js,ts,jsx,tsx}',
  ],
  // ... rest of your config
}

Custom Styling

You can customize the appearance by wrapping the component and applying custom CSS classes or by modifying your Tailwind theme.

🔐 Environment Variables

| Variable | Required | Description | |----------|----------|-------------| | OPENAI_API_KEY | Yes (for AI mode) | Your OpenAI API key |

Getting an OpenAI API Key

  1. Go to OpenAI Platform
  2. Sign up or log in
  3. Navigate to API Keys section
  4. Create a new API key
  5. Add it to your .env.local file

🌐 Browser Support

  • ✅ Chrome (Desktop & Mobile)
  • ✅ Edge (Desktop & Mobile)
  • ✅ Safari (Desktop & Mobile)
  • ⚠️ Firefox (Desktop only - limited speech recognition support)

The Web Speech API is required for voice recognition. The component will automatically hide itself if speech recognition is not supported.

📱 Responsive Design

The component is fully responsive with:

  • Mobile: Bottom sheet layout, larger touch targets
  • Tablet: Optimized positioning and sizing
  • Desktop: Traditional floating UI with compact controls

🛠️ Advanced Usage

Without AI Mode (Keyword Matching Only)

You can use the component without OpenAI by simply not setting the OPENAI_API_KEY or by keeping AI mode disabled:

<VoiceNavigationAdvanced
  defaultAIMode={false}
/>

Custom API Endpoint

If you're hosting the API route at a different path:

<VoiceNavigationAdvanced
  apiEndpoint="/api/custom/voice"
/>

Programmatic Control

Access the component via ref for programmatic control (advanced):

const voiceNavRef = useRef()

// Toggle listening programmatically
voiceNavRef.current?.toggleListening()

🧪 Testing

The component includes built-in error handling for:

  • Microphone permission denied
  • Network failures
  • API errors
  • Unsupported browsers

📄 License

MIT © LiaPlus

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📞 Support

🙏 Acknowledgments


Made with ❤️ by LiaPlus