-
Data Grid
- Overview
-
Data Binding
-
Paging and Scrolling
-
Editing
-
Grouping
-
Filtering and Sorting
- Focused Row
-
Row Drag & Drop
-
Selection
-
Columns
- State Persistence
-
Appearance
-
Templates
-
Data Summaries
-
Master-Detail
-
Export to PDF
-
Export to Excel
-
Adaptability
- Keyboard Navigation
-
Pivot Grid
- Overview
-
Data Binding
-
Field Chooser
-
Features
-
Export to Excel
-
Tree List
- Overview
-
Data Binding
- Sorting
- Paging
-
Editing
- Node Drag & Drop
- Focused Row
-
Selection
-
Filtering
-
Column Customization
- State Persistence
- Adaptability
- Keyboard Navigation
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Features
- Virtual Scrolling
-
Grouping
-
Customization
- Adaptability
-
Html Editor
-
Chat
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
Charts
- Overview
-
Data Binding
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Line Charts
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
-
Sparkline Charts
-
Tree Map
-
Funnel and Pyramid Charts
- Sankey Chart
-
Combinations
-
More Features
-
Export
-
Selection
-
Tooltips
-
Zooming
-
-
Gantt
- Overview
-
Data
-
UI Customization
- Strip Lines
- Export to PDF
- Sorting
-
Filtering
-
Gauges
- Overview
-
Data Binding
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Navigation
- Overview
- Accordion
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
- Pagination
-
Tree View
- Right-to-Left Support
-
Layout
-
Tile View
- Splitter
-
Gallery
- Scroll View
- Box
- Responsive Box
- Resizable
-
-
Editors
- Overview
- Autocomplete
-
Calendar
- Check Box
- Color Box
-
Date Box
-
Date Range Box
-
Drop Down Box
-
Number Box
-
Select Box
- Switch
-
Tag Box
- Text Area
- Text Box
- Validation
- Custom Text Editor Buttons
- Right-to-Left Support
- Editor Appearance Variants
-
Forms and Multi-Purpose
- Overview
- Button Group
- Field Set
-
Filter Builder
-
Form
- Radio Group
-
Range Selector
- Numeric Scale (Lightweight)
- Numeric Scale
- Date-Time Scale (Lightweight)
- Date-Time Scale
- Logarithmic Scale
- Discrete scale
- Custom Formatting
- Use Range Selection for Calculation
- Use Range Selection for Filtering
- Image on Background
- Chart on Background
- Customized Chart on Background
- Chart on Background with Series Template
- Range Slider
- Slider
-
Sortable
-
File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Actions and Lists
- Overview
-
Action Sheet
-
Button
- Floating Action Button
- Drop Down Button
-
Context Menu
-
List
-
Lookup
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
React Tab Panel - Templates
This demo illustrates the use of templates in TabPanel. If your data objects contain custom fields, you need to specify the itemTitleRender/itemTitleComponent and itemRender/itemComponent that define how to display the fields in tabs and views.
If you want each tab and view to have differently structured content, define individual renders. To do this, assign an array of objects to the items[] or dataSource property and specify the tabRender/tabComponent and render/component properties in each object. This use case is illustrated in the following tutorial: Getting Started with TabPanel.
Use the following properties to configure user navigation between tabs:
-
swipeEnabled
Defines whether to switch between views with a swipe gesture. -
loop
Specifies whether to loop views. -
animationEnabled
Specifies whether to animate transition between views.
You can switch the checkboxes below the TabPanel to change the loop, animationEnabled, and swipeEnabled property values.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
import React, { useCallback, useState } from 'react';
import CheckBox, { CheckBoxTypes } from 'devextreme-react/check-box';
import TabPanel, { TabPanelTypes } from 'devextreme-react/tab-panel';
import { multiViewItems as companies } from './data.ts';
import CompanyItem from './CompanyItem.tsx';
const itemTitleRender = (company) => <span>{company.CompanyName}</span>;
const App = () => {
const [animationEnabled, setAnimationEnabled] = useState(true);
const [swipeEnabled, setSwipeEnabled] = useState(true);
const [loop, setLoop] = useState(false);
const [selectedIndex, setSelectedIndex] = useState(0);
const onSelectionChanged = useCallback((args: TabPanelTypes.OptionChangedEvent) => {
if (args.name === 'selectedIndex') {
setSelectedIndex(args.value);
}
}, [setSelectedIndex]);
const onLoopChanged = useCallback((args: CheckBoxTypes.ValueChangedEvent) => {
setLoop(args.value);
}, [setLoop]);
const onAnimationEnabledChanged = useCallback((args: CheckBoxTypes.ValueChangedEvent) => {
setAnimationEnabled(args.value);
}, [setAnimationEnabled]);
const onSwipeEnabledChanged = useCallback((args: CheckBoxTypes.ValueChangedEvent) => {
setSwipeEnabled(args.value);
}, [setSwipeEnabled]);
return (
<div>
<TabPanel
height={260}
dataSource={companies}
selectedIndex={selectedIndex}
onOptionChanged={onSelectionChanged}
loop={loop}
itemTitleRender={itemTitleRender}
itemComponent={CompanyItem}
animationEnabled={animationEnabled}
swipeEnabled={swipeEnabled}
/>
<div className="item-box">
Item <span>{selectedIndex + 1}</span> of <span>{companies.length}</span>
</div>
<div className="options">
<div className="caption">Options</div>
<div className="option">
<CheckBox
value={loop}
onValueChanged={onLoopChanged}
text="Loop enabled"
/>
</div>
<div className="option">
<CheckBox
value={animationEnabled}
onValueChanged={onAnimationEnabledChanged}
text="Animation enabled"
/>
</div>
<div className="option">
<CheckBox
value={swipeEnabled}
onValueChanged={onSwipeEnabledChanged}
text="Swipe enabled"
/>
</div>
</div>
</div>
);
};
export default App;
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx