Implementing Tabs in Syncfusion React
The Tab component organizes related content into tabbed sections with headers, allowing users to switch between views. This comprehensive skill guides you through setup, customization, content rendering strategies, API methods, events, accessibility, animations, persistence, and advanced features like drag-and-drop reordering.
Table of Contents
- When to Use This Skill
- Component Overview
- Documentation and Navigation Guide
- Quick Start Example
- Common Patterns
- Key Properties Overview
- Methods & API Reference
- Events & Event Arguments
- Animation & Advanced Settings
- Related Skills
When to Use This Skill
- Creating tabbed interfaces with header-based navigation
- Organizing content into logical sections or views
- Building responsive layouts with scrollable or popup overflow handling
- Customizing header styling and icon positioning
- Managing content rendering performance (lazy loading, dynamic, or initial render)
- Implementing drag-and-drop tab reordering for user customization
- Adding localization support for international applications
- Ensuring accessibility compliance (WCAG, ARIA, keyboard navigation)
- Styling tabs with custom CSS or theme customization
- Programmatically managing tabs (add, remove, select, hide/show)
- Handling tab-related events (selection, drag-drop, add, remove)
- Preserving user preferences with state persistence
- Implementing smooth animations and transitions
Component Overview
The Tab component is a navigation control that displays content organized into tabs. Each tab has a header and associated content. Tabs support:
- Multiple header positions (top, bottom, left, right)
- Overflow handling (scrollable navigation or popup mode)
- Flexible content rendering (on-demand, dynamic, or initial load)
- Drag-and-drop reordering for interactive tab management
- Full accessibility with ARIA attributes and keyboard navigation
- Extensive customization via CSS and theme options
- Internationalization through localization APIs
- Animation effects for content transitions
- State persistence across page reloads
- HTML sanitization for security
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md [blocked]
- Package dependencies and installation
- Vite and Create React App setup
- CSS imports and theme configuration
- Basic tab initialization with JSON items
- Minimal working example and running the app
When to read: Start here to set up a basic Tab component in your React application.
Header Styling & Customization
📄 Read: references/header-styling.md [blocked]
- Built-in header style classes (e-fill, e-background, e-accent)
- Icon positioning options (left, right, top, bottom)
- Icon and header customization with CSS classes
- Code examples for styled headers
- Styling content and hover states
When to read: Use this when you need to customize tab header appearance, add icons, or apply predefined styles.
Orientation & Overflow Modes
📄 Read: references/orientation-overflow.md [blocked]
- Header placement positions (top, bottom, left, right)
- Scrollable mode with navigation arrows
- Popup mode with dropdown display
- Touch and swipe support
- Width constraints and responsive behavior
When to read: Use this when you need to control header position, handle many tabs with overflow, or build responsive layouts.
Content Rendering Strategies
📄 Read: references/content-rendering.md [blocked]
- On-demand rendering (lazy loading, default mode)
- Dynamic rendering for state-isolated tabs
- Initial rendering for state preservation
- Performance vs. state considerations
- Choosing the right rendering mode
When to read: Use this to optimize tab content performance or preserve user interactions across tab switches.
Drag and Drop Reordering
📄 Read: references/drag-drop-reordering.md [blocked]
- Enabling drag-and-drop with allowDragAndDrop
- Handling drag events (onDragStart, dragging, dragged)
- Preventing drag/drop for specific items
- Tab-to-tab drag and drop
- Dragging tabs to external sources (TreeView)
- Drag area constraints
When to read: Use this to allow users to reorder tabs or integrate tab dragging with other components.
Accessibility & Localization
📄 Read: references/accessibility-localization.md [blocked]
- WCAG 2.2 and Section 508 compliance
- ARIA attributes and roles for tabs
- Keyboard navigation (arrows, Home, End, Enter, Escape)
- Screen reader support
- Localization with L10n class
- Right-to-left (RTL) language support
When to read: Use this when building accessible applications or supporting multiple languages.
Quick Start Example
Here's a minimal Tab component setup:
Common Patterns
Pattern 1: Styled Tabs with Icons
Pattern 2: Vertical Tabs on the Left
Pattern 3: Lazy-Loaded Content (Default)
Pattern 4: Draggable Tabs
Key Properties Overview
Methods & API Reference
addTab(items, index)
Adds new items to the Tab component. The items are inserted at the specified index.
Parameters:
items- Array ofTabItemModelobjects to addindex(optional) - Position where items should be inserted. Default is 0.
Returns: void
Example:
removeTab(index)
Removes a tab item at the specified index.
Parameters:
index- The index of the tab to remove
Returns: void
Example:
select(args, event)
Selects a tab by index or DOM element. Programmatically switches to a different tab.
Parameters:
args- Index (number) or HTMLElement of the tab to selectevent(optional) - DOM event object
Returns: void
Example:
enableTab(index, value)
Enables or disables a specific tab item. Disabled tabs cannot be selected but remain visible.
Parameters:
index- Index of the tab to enable/disablevalue- Boolean.trueto enable,falseto disable
Returns: void
Example:
hideTab(index, value)
Shows or hides a tab item at the specified index. Hidden tabs are removed from the DOM.
Parameters:
index- Index of the tab to show/hidevalue(optional) - Boolean.trueto hide,falseto show. Default istrue
Returns: void
Example:
getItemIndex(tabItemId)
Gets the index of a tab item by its ID.
Parameters:
tabItemId- The ID of the tab item
Returns: number - The index of the tab, or -1 if not found
Example:
refresh()
Refreshes the entire Tab component. Useful after dynamically changing items or properties.
Parameters: None
Returns: void
Example:
refreshActiveTab()
Refreshes only the content of the currently active tab. Does not reload other tabs.
Parameters: None
Returns: void
Example:
refreshActiveTabBorder()
Refreshes the active tab's visual indicator (underline/border). Useful after styling changes.
Parameters: None
Returns: void
Example:
refreshOverflow()
Reorganizes and adjusts the Tab headers to fit the available width without re-rendering the entire component. Useful for responsive layouts.
Parameters: None
Returns: void
Example:
disable(value)
Disables or enables the entire Tab component.
Parameters:
value- Boolean.trueto disable,falseto enable
Returns: void
Example:
destroy()
Removes the component from the DOM and detaches all event handlers, attributes, and classes.
Parameters: None
Returns: void
Example:
Events & Event Arguments
The Tab component provides comprehensive event support for handling user interactions and component state changes.
selected
Fired after a tab item is selected. Used to execute actions when the user switches to a different tab.
Event Arguments: SelectEventArgs
SelectEventArgs Properties:
selectedIndex(number) - Index of the newly selected tabselectedItem(HTMLElement) - DOM element of the selected tabselectedContent(HTMLElement) - Content area of the selected tabpreviousIndex(number) - Index of the previously selected tabpreviousItem(HTMLElement) - DOM element of the previous tabisInteracted(boolean) - Whether selection was triggered by user interaction (true) or programmatically (false)isSwiped(boolean) - Whether selection was triggered by swipe gesturepreventFocus(boolean) - Set to true to prevent focus on selected tabcancel(boolean) - Set to true to prevent the selection
Example:
selecting
Fired before a tab item is selected. Use this to prevent selection under certain conditions.
Event Arguments: SelectingEventArgs (same properties as SelectEventArgs)
Example:
added
Fired after a new tab item is added to the component.
Event Arguments: AddEventArgs
AddEventArgs Properties:
addedItems(TabItemModel[]) - Array of added tab itemsname(string) - Name of the eventcancel(boolean) - Set to true to prevent the action
Example:
adding
Fired before a new tab item is added. Use this to validate or modify items before addition.
Event Arguments: AddEventArgs
Example:
removed
Fired after a tab item is removed from the component.
Event Arguments: RemoveEventArgs
RemoveEventArgs Properties:
removedItem(HTMLElement) - DOM element of the removed tabindex(number) - Index of the removed tabname(string) - Name of the event
Example:
removing
Fired before a tab item is removed. Use this to prevent removal under certain conditions.
Event Arguments: RemoveEventArgs
Example:
onDragStart
Fired before dragging a tab item. Use this to prevent dragging specific tabs or customize drag behavior.
Event Arguments: DragEventArgs
DragEventArgs Properties:
draggedItem(HTMLElement) - The tab being draggedclonedElement(HTMLElement) - Clone of the dragged elementevent(MouseEvent) - The drag eventindex(number) - Index of the dragged tabcancel(boolean) - Set to true to prevent draggingname(string) - Name of the eventtarget(HTMLElement) - Target elementdroppedItem(HTMLElement) - The item being dropped on
Example:
dragging
Fired while a tab is being dragged.
Event Arguments: DragEventArgs
Example:
dragged
Fired after a tab has been successfully dropped to a new position.
Event Arguments: DragEventArgs
Example:
created
Fired after the Tab component is completely rendered and initialized.
Event Arguments: Event
Example:
destroyed
Fired when the Tab component is destroyed and removed from the DOM.
Event Arguments: Event
Example:
Animation & Advanced Settings
The Tab component supports advanced features including animations, HTML sanitization, and state persistence.
Animation Configuration
Control how tab content transitions between selections using the animation property.
Animation Settings:
previous- Animation effect when navigating to previous tabnext- Animation effect when navigating to next tab- Each animation has:
effect,duration(ms),easing
Available Animation Effects:
SlideLeftIn- Slide from right to leftSlideRightIn- Slide from left to rightSlideUpIn- Slide from bottom to topSlideDownIn- Slide from top to bottomFadeIn- Fade in effectFadeOut- Fade out effectFadeZoomIn- Fade with zoom inFadeZoomOut- Fade with zoom outZoomIn- Zoom in effectZoomOut- Zoom out effectNone- No animation
Example: Custom Animation
Example: Disabling Animation
HTML Sanitization
Protect against XSS attacks by enabling HTML sanitization. The enableHtmlSanitizer property controls whether untrusted HTML is sanitized.
Example: HTML Sanitization
State Persistence
The enablePersistence property allows the Tab component to persist the selected tab across page reloads.
Example: State Persistence
Persisted State:
selectedItem- The index of the currently active tab
The persistence uses browser local storage to save and restore the state.
Swipe Navigation
The swipeMode property enables or disables tab navigation using swipe gestures. This is particularly useful for mobile devices and touch interfaces, but can be customized to prevent accidental swipes.
SwipeMode Options:
Both(default) - Allows swipe with both touch and mouseTouch- Allows swipe with touch gestures onlyMouse- Allows swipe with mouse gestures onlyNone- Disables swipe navigation completely
Example: Disable Swipe to Prevent Accidental Tab Changes
Example: Disable Swipe for Mouse, Allow Touch
Tab Scroll Step Customization
The scrollStep property controls the distance (in pixels) that tab headers scroll when you click the left and right navigation arrows. This is useful for fine-tuning the scroll behavior when tabs overflow.
Example: Custom Scroll Step
Advanced Settings: CSS Classes and RTL
Custom CSS Classes
Apply custom styling using the cssClass property:
RTL (Right-to-Left) Support
Enable RTL layout for Arabic, Hebrew, and other RTL languages:
Combined Advanced Example
Related Skills
- Implementing Accordion - Similar navigation component for collapsible content
- Implementing Sidebars - Complementary navigation pattern
- Implementing Breadcrumbs - Navigation context alongside tabs


