# Tab Strip

## Content

SpreadJS provides plenty of options to control the behavior of the tab strip and its elements. You can perform various operations such as changing the sheet name, setting sheet color, arranging sheets, setting the position and width of tab strip, etc. by using the properties of the **Workbook.options** field.

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/tabstriplabel.png)

## Change Sheet Name

You can change the name of a sheet by double-clicking on it to edit. Click out of the tab or use the Esc or Enter key to confirm the changes.

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/edit-sheet-names.gif)

You can enable or disable the ability to edit sheet names by using **options.tabEditable** property. The default value of this property is true.

```javascript
spread.options.tabEditable = false; // false: disable, true: enable
```

## Arrange Sheet Tabs

You can arrange sheet names in the tab strip by selecting the sheet tab and dragging it between any two sheets. An indicator is displayed while dragging the sheet, as shown in the below image. Release the mouse to move the sheet.

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/tab-reorder.png)

You can enable the ability to re-order the sheet tabs by setting the **options.allowSheetReorder** property to true.

```
spread.options.allowSheetReorder = true; // true: enable, false: disable
```

The [SheetMoving](/spreadjs/api/v16/classes/GC.Spread.Sheets.Events#SheetMoving_EV) and [SheetMoved](/spreadjs/api/v16/classes/GC.Spread.Sheets.Events#SheetMoved_EV) events occur before and after the sheet is dragged and moved respectively. In order to cancel the movement of sheet, you can set the **cancel** parameter of [SheetMoving](/spreadjs/api/v16/classes/GC.Spread.Sheets.Events#SheetMoving_EV) class to true.

## Set Sheet Tab Color

You can set the sheet tab color using **options.sheetTabColor** property. Also, you can choose to display any sheet as the start sheet using [startSheetIndex](/spreadjs/api/v16/classes/GC.Spread.Sheets.Workbook#startSheetIndex) method.

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/tabstripcolor.png)

```javascript
spread.setSheetCount(3);
spread.startSheetIndex(0);
spread.getSheet(0).options.sheetTabColor = "red";
spread.getSheet(1).options.sheetTabColor = "#FFFF00";
spread.getSheet(2).options.sheetTabColor = "Accent 4";
```

## Display New Tab Button

You can choose to show or hide the New Tab button by using **options.newTabVisible** property. This button is visible by default.

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/newtabvisible.png)

```javascript
spread.options.newTabVisible = true; // false: hide, true: show
```

## Display Navigation Buttons

You can specify whether to show the navigation buttons in the workbook by using **options.tabNavigationVisible** property.

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/tabnavigation.png)

```javascript
spread.options.tabNavigationVisible = false; // false: hide, true: show
```

## Display Tab Strip

You can hide the entire tab strip by using **options.tabStripVisible** property.

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/tabstripvisible.png)

```javascript
spread.options.tabStripVisible = true; // true: show, false: hide
spread.options.tabStripRatio = 0.5;  // percentage value that specifies the horizontal space allocated to the tab strip
```

## Set Position and Width

You can set the position of the tab strip relative to the workbook using the **tabstripPosition** workbook option. These positions are supported on touch devices as well as in all SpreadJS themes. The tab strip gets separated from the scrollbar if the position is set to left, right, or top.

| Position | Image |
| -------- | ----- |
| Bottom (default) | ![tabBottom.png](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/tabBottom.ba0830.png) |
| Left | ![tabLeft.png](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/tabLeft.5b3641.png) |
| Right | ![tabRight.png](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/tabRight.c61b99.png) |
| Top | ![tabTop.png](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/tabTop.bf524c.png) |

> **Note:** The resize horizontal bar button is visible only when the position of the tab strip is set to the bottom. The **tabStripRatio** property is also ignored when the top, left or right position is set.

If the sheet position is set to the left or right and the sheet name is too long to be displayed, it is clipped and indicated by an ellipsis. However, you can change the width of the tab strip to show the complete sheet name by using **options.tabStripWidth** property. The default and minimum value of this property is 80px.

> **Note:** The **options.tabStripWidth** property is ignored if the tab strip position is not set to the left or right of the workbook.

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/tabstripWidth.png)

The following example code sets tab strip position and width.

```javascript
// Change tab strip position when creating workbook
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {tabStripPosition: GC.Spread.Sheets.TabStripPosition.top});
// Or change tab strip position by workbook options
spread.options.tabStripPosition = GC.Spread.Sheets.TabStripPosition.top;
       
// Change tab strip width when creating workbook
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), {tabStripWidth: 200});
// Or change tab strip width by workbook options
spread.options.tabStripWidth = 200;        
```

## The “All Sheets” button

SpreadJS provides an “All Sheets” hamburger button in the tab strip that helps navigate to specific sheet(s) in a workbook more quickly. The button opens a drop-down list consisting of the available sheet(s).

The “All Sheets” button automatically appears when all the sheets cannot be displayed completely in the tab strip. It can also be displayed by resizing the bar to hide sheets.

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/tabstrip-allsheetsbutton.gif)

You can choose whether to display the hamburger button by setting the **allSheetsListVisible**  option using the [AllSheetsListVisibility](/spreadjs/api/v16/enums/GC.Spread.Sheets.AllSheetsListVisibility)
enumeration values such as “hide”, “show”, and “auto” (default).

```javascript
// Automatically show or hide the "All Sheets" button - Default
function AutoButton(spread) {
    spread.options.allSheetsListVisible = GC.Spread.Sheets.AllSheetsListVisibility.auto;
}

// Always show the "All Sheets" button
function ShowButton(spread) {
    spread.options.allSheetsListVisible = GC.Spread.Sheets.AllSheetsListVisibility.show;
}

// Hide the "All Sheets" button
function HideButton(spread) {
    spread.options.allSheetsListVisible = GC.Spread.Sheets.AllSheetsListVisibility.hide;
}
```

> **Note:** The position of the “All Sheets” hamburger button is retained irrespective of the set value in the **allSheetsListVisible** option.

The below table depicts different scenarios associated with the “All Sheets” hamburger button.

| Scenario | Example |
| -------- | ------- |
| The “All Sheets” dialog highlights the active sheet and the hovered sheet. | ![tabstrip-allsheets-case1.png](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/tabstrip-allsheets-case1.f577f8.png) |
| The “All Sheets” button changes color on the hover. | ![tabstrip-allsheets-case2.gif](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/tabstrip-allsheets-case2.5908c6.gif) |
| The “All sheets” dialog highlights all the selected active sheets. | ![tabstrip-allsheets-case3.png](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/tabstrip-allsheets-case3.0c265d.png) |
| The tab strip will display the selected sheet from the “All Sheets” dialog if it is not in the currently displayed area. | ![tabstrip-allsheets-case4.gif](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/tabstrip-allsheets-case4.de783a.gif) |
| The “All Sheets” dialog does not show hidden sheets.<br>For example, Sheet4, Sheet6, and Sheet7 are hidden sheets in the example image. | ![tabstrip-allsheets-case5.png](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/tabstrip-allsheets-case5.e79c37.png) |

## Using SpreadJS Designer

You can also set the tab strip options using SpreadJS Designer by accessing the TabStrip settings in the "SETTINGS" ribbon tab as shown below:

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/tabstripDesign1.png)

![](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/8d606653-16a0-474d-b9dc-e2b4d01c2446/images/tabstripDesign2.png)