@@ -167,7 +167,7 @@ export default () => {
167
167
168
168
** NOTE :**
169
169
170
- - Tabs can't be manipulated safely before the first render, use ready() to make a function available after the component is mounted.
170
+ - Tabs can't be manipulated safely before the first render, use ready() to access the instance object when the component is mounted.
171
171
172
172
- ready function and instance Object will not be changed after re-rendering multiple times.
173
173
@@ -232,7 +232,7 @@ const [TabList, PanelList, ready] = useDynTabs({
232
232
<td>string</td>
233
233
<td>' '</td>
234
234
<td>false</td>
235
- <td>initial selected tab id </td>
235
+ <td>specifies initial selected tab</td>
236
236
</tr>
237
237
</tbody >
238
238
</table >
@@ -345,7 +345,7 @@ Default value for panelComponent option.
345
345
const [TabList , PanelList , ready ] = useDynTabs ({
346
346
defaultPanelComponent : (props ) => {
347
347
const {id , isSelected , api: instance } = props;
348
- return < div>< / div> ;
348
+ return < div> loading ... < / div> ;
349
349
},
350
350
});
351
351
```
@@ -377,7 +377,7 @@ const [TabList, PanelList, ready] = useDynTabs({accessibility: false});
377
377
378
378
** NOTE :**
379
379
380
- This option assigns id attribute on panel element and button element inside the tab. for having elements without id attribute, set this option to false .
380
+ When accessibility option is true, it sets the id attribute of panel and button elements .
381
381
382
382
### isVertical
383
383
@@ -416,7 +416,7 @@ const [TabList, PanelList, ready] = useDynTabs({isVertical: true});
416
416
<tr>
417
417
<td>function</td>
418
418
<td>false</td>
419
- <td>This event is fired only once, after first render</td>
419
+ <td>This event is fired only once, after the first render</td>
420
420
</tr>
421
421
</tbody >
422
422
</table >
@@ -433,7 +433,7 @@ const [TabList, PanelList, ready] = useDynTabs({
433
433
434
434
** NOTE :**
435
435
436
- You can use 'this' keyword inside all callback options which refers to the instance object.
436
+ You can use 'this' keyword inside all callback options. It refers to the instance object.
437
437
438
438
### onInit
439
439
@@ -563,7 +563,7 @@ const [TabList, PanelList, ready] = useDynTabs({
563
563
<tr>
564
564
<td>function</td>
565
565
<td>false</td>
566
- <td>fires after selecting tabs . this event is not fired initially</td>
566
+ <td>fires after selecting a tab . this event is not fired initially</td>
567
567
</tr>
568
568
</tbody >
569
569
</table >
@@ -708,7 +708,7 @@ const result = instance.isOpen('Your tab ID');
708
708
709
709
### open
710
710
711
- Triggers 'onInit', 'onChange' and 'onOpen' event. opening an already opened tab only triggers 'onInit' event.
711
+ Triggers 'onInit', 'onChange' and 'onOpen' event.
712
712
713
713
Return value : Promise
714
714
@@ -756,8 +756,6 @@ Makes current and previous selected tab to be re-rendered
756
756
757
757
Triggers 'onInit', 'onChange' and 'onSelect' event.
758
758
759
- Selecting an already selected tab only triggers 'onInit' event.
760
-
761
759
Return value : Promise
762
760
763
761
Parameters:
@@ -778,9 +776,7 @@ if (instance.isSelected('1') == false) {
778
776
779
777
Triggers 'onInit', 'onChange' and 'onClose' event.
780
778
781
- Closing an already closed tab only triggers 'onInit' event.
782
-
783
- It switches to the previously selected tab before closing if switching parameter was true and tab was already opened and selected.
779
+ When switching parameter is true, it switches to previous selected tab
784
780
785
781
Return value : Promise
786
782
@@ -990,7 +986,7 @@ const {selectedTabID, openTabIDs} = instance.getPreviousData();
990
986
<td>string</td>
991
987
<td></td>
992
988
<td>false</td>
993
- <td>a unique identifier for each tab</td>
989
+ <td>an unique identifier for each tab</td>
994
990
</tr>
995
991
<tr>
996
992
<td>title</td>
@@ -1105,19 +1101,22 @@ useDynTabs({
1105
1101
tabs: [
1106
1102
{id: ' 1' , title: ' eager loading tab 1' , panelComponent: < p> panel 1 < / p> },
1107
1103
{id: ' 2' , title: ' eager loading tab 2' , lazy: true , panelComponent: < p> panel 2 < / p> },
1108
- {id: ' 3' , title: ' lazy loading tab 3' , lazy: true , panelComponent : < div > Loading ... < / div > },
1104
+ {id: ' 3' , title: ' lazy loading tab 3' , lazy: true },
1109
1105
],
1110
- onFirstSelect : function ({currentSelectedTabId, previousSelectedTabId}) {
1106
+ selectedTabID: ' 1' ,
1107
+ defaultPanelComponent : function DefaultPanel () {
1108
+ return < div> loading... < / div> ;
1109
+ },
1110
+ onFirstSelect : function ({currentSelectedTabId}) {
1111
1111
const instance = this ;
1112
1112
if (currentSelectedTabId === ' 3' ) {
1113
- import (' ./components /panel3.js' ).then ((defaultExportedModule ) => {
1113
+ import (' path to /panel3.js' ).then ((defaultExportedModule ) => {
1114
1114
const Panel3 = defaultExportedModule .default ;
1115
1115
instance .setTab (' 3' , {panelComponent: Panel3});
1116
1116
instance .refresh ();
1117
1117
});
1118
1118
}
1119
1119
},
1120
- selectedTabID: ' 1' ,
1121
1120
});
1122
1121
```
1123
1122
@@ -1146,19 +1145,7 @@ You can find other themes at themes folder and multiple themes example at exampl
1146
1145
1147
1146
These deprecated features can still be used, but should be used with caution because they are expected to be removed entirely sometime in the future. You should work to remove their use from your code.
1148
1147
1149
- - Third element of returned array by useDynTabs hook should not be used as an object, it is no longer recommended and only be kept for backwards compatibility purposes, may be removed in the future. Avoid using it as an object and use the code below instead of it.
1150
-
1151
- ``` js
1152
- const [TabList , PanelList , ready ] = useDynTabs (options);
1153
- const open_tab_3 = function () {
1154
- ready (function (instance ) {
1155
- if (instance .isOpen (' 3' ) === false ) {
1156
- instance .open ({id: ' 3' , title: ' mock tab 3' });
1157
- instance .select (' 3' );
1158
- }
1159
- });
1160
- };
1161
- ```
1148
+ - Third element of returned array by useDynTabs hook should not be used as an object, it is no longer recommended and only be kept for backwards compatibility purposes, it should be used as a function.
1162
1149
1163
1150
- First parameter of onSelect function is an object and has perviousSelectedTabId property which is deprecated. you should use previousSelectedTabId property instead of perviousSelectedTabId property.
1164
1151
0 commit comments