Role-Based Navigation

AI
Adaptive
Navigation

Navigation that adapts based on user role and usage frequency, optimizing the interface for each user's workflow.

Preview

Navigation that adapts based on user role and usage frequency

Role-Based Nav

Adapts to your role

Primary Navigation
Quick Actions
Navigation order optimized based on your usage frequency

Props

Component API reference

RoleBasedNavigation

PropTypeDefaultDescription
defaultRoleRoleKey'product-manager'Default selected role
roleRoleKeyControlled role value
onRoleChange(role: RoleKey) => voidCalled when role changes
rolesRole[]Default rolesAvailable roles configuration
onNavClick(item, roleId) => voidCalled when nav item is clicked
onQuickActionClick(action, roleId) => voidCalled when quick action is clicked
aiMessagestring'Navigation order optimized...'AI optimization message
classNamestringAdditional CSS classes

Types

type RoleKey = 'product-manager' | 'developer' | 'designer' interface Role { id: RoleKey label: string primaryNav: string[] quickActions: string[] }

Usage

Import and implementation examples

import { RoleBasedNavigation } from '@/components/ui/role-based-navigation'

// Basic usage with defaults
<RoleBasedNavigation />

// Controlled component
<RoleBasedNavigation
  defaultRole="product-manager"
  onRoleChange={(role) => console.log('Role changed:', role)}
  onNavClick={(item, roleId) => {
    console.log('Nav item clicked:', item, 'for role:', roleId)
  }}
  onQuickActionClick={(action, roleId) => {
    console.log('Quick action:', action, 'for role:', roleId)
  }}
  aiMessage="Navigation order optimized based on your usage frequency"
/>

// Custom roles configuration
const customRoles = [
  {
    id: 'admin',
    label: 'Administrator',
    primaryNav: ['Dashboard', 'Users', 'Settings', 'Logs'],
    quickActions: ['Add User', 'View Reports', 'System Settings']
  },
  {
    id: 'user',
    label: 'User',
    primaryNav: ['Dashboard', 'Profile', 'Help'],
    quickActions: ['New Request', 'View History']
  }
]

<RoleBasedNavigation roles={customRoles} />
This block is self-contained (no UI component dependencies)

Features

Built-in functionality

  • Multiple role types: Support for Product Manager, Developer, Designer roles
  • Usage frequency tracking: AI-powered optimization based on navigation patterns
  • Adapted primary navigation: Different nav items for each role
  • Quick actions: Role-specific quick action shortcuts
  • AI optimization indicators: Visual feedback on AI-driven improvements
  • Custom layouts: Personalized based on user behavior
  • Controlled mode: Both controlled and uncontrolled usage
  • Dark mode: Full dark mode support

Accessibility

Accessibility considerations

ARIA Attributes

Uses role="navigation" for main containerrole="tablist" for role selectionaria-selected for active roleProper button semantics for all actions

Keyboard Navigation

KeyAction
TabNavigate between roles and items
Enter/SpaceSelect role or activate item
Arrow KeysNavigate within role selector

Notes

  • Focus management on role change
  • Screen reader announces role changes
  • AI optimization message is accessible