CIA Compliance Manager API Documentation - v1.1.6
    Preparing search index...

    Function useTabs

    • Hook for managing tab state with keyboard navigation

      This hook provides:

      • Tab selection state management
      • Keyboard navigation (Arrow Left/Right, Home, End)
      • Focus management for tab buttons
      • Support for disabled tabs

      Parameters

      • tabs: Tab[]

        Array of tab configurations

      • options: UseTabsOptions = {}

        Optional configuration for initial tab and change callback

      Returns UseTabsReturn

      Tab state and handlers

      const tabs: Tab[] = [
      { id: 'tab1', label: 'First Tab', content: <div>Content 1</div> },
      { id: 'tab2', label: 'Second Tab', content: <div>Content 2</div> },
      ];

      const { activeTab, selectTab, handleKeyDown, tabRefs } = useTabs(tabs, {
      initialTab: 'tab1',
      onChange: (tabId) => console.log('Tab changed to:', tabId),
      });