vwf .

API Reference

Complete API documentation for components, utilities, and framework core

Reference/API/SecondaryNav

SecondaryNav

Tab navigation component with 4 visual variants, responsive design, and icon support

🔧 Props

PropertyTypeDefaultDescription
tabs*Array-Array of tab objects: { id, label, icon?, description? }
defaultTabstringtabs[0]?.idDefault active tab id
onTabChangeFunctionundefinedCallback when tab changes: (tabId) => void
variantstring'default''default', 'pills', 'underline', 'cards'
sizestring'md''sm', 'md', 'lg'
showDescriptionbooleanfalseWhether to show tab descriptions (if provided)
responsivebooleantrueWhether to collapse/abbreviate on mobile
persistKeystringwindow.location.pathnameUnique key for HMR persistence
classstring-Additional CSS classes
...htmlPropsobject{}Standard HTML attributes for <nav>

✨ Features

Four visual variants for different use cases

Three size options (sm, md, lg)

Reactive active tab tracking with VanJS state

Responsive design with mobile abbreviations

Optional descriptions shown on larger screens

ARIA attributes for accessibility (role="tab", aria-selected)

Tab change callback for external integration

HMR state persistence support with persistKey

Icon support with Oracle Icon Font classes

Flexible layout adapts to tab count and variant

💻 Examples

Underline Variant

return SecondaryNav({
  tabs: [
    { id: 'overview', label: 'Overview' },
    { id: 'activity', label: 'Activity' },
    { id: 'settings', label: 'Settings' }
  ],
  variant: 'underline'
})

▶️ Live Preview

💡 Click "Edit Code" to modify the example

🔄 Click "Apply Changes" to see your modifications

↩️ Click "Reset" to restore original code

Pills with Callback

return SecondaryNav({
  tabs: [
    { id: 'all', label: 'All' },
    { id: 'active', label: 'Active' },
    { id: 'completed', label: 'Completed' }
  ],
  variant: 'pills',
  onTabChange: (tabId) => {
    filterStatus.val = tabId;
  }
})

▶️ Live Preview

💡 Click "Edit Code" to modify the example

🔄 Click "Apply Changes" to see your modifications

↩️ Click "Reset" to restore original code

Cards with Icons and Descriptions

return SecondaryNav({
  tabs: [
    {
      id: 'feed',
      label: 'Home Feed',
      icon: 'oj-ux-ico-home',
      description: 'See what\'s happening in your neighborhood'
    },
    {
      id: 'discover',
      label: 'Discover',
      icon: 'oj-ux-ico-location-searching',
      description: 'Find new services and neighbors'
    }
  ],
  variant: 'cards',
  showDescription: true
})

▶️ Live Preview

💡 Click "Edit Code" to modify the example

🔄 Click "Apply Changes" to see your modifications

↩️ Click "Reset" to restore original code

💡 Usage Tips

🔗 Related

Explore vwf

Discover what vwf can do