1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-24 17:31:50 +00:00
The-Modding-Tree/docs/subtabs-and-microtabs.md

56 lines
2.1 KiB
Markdown
Raw Normal View History

# Subtabs and Microtabs
2020-10-27 23:25:03 +00:00
Subtabs are separate sections of a tab that you can view by selecting one at the top of the tab. Microtabs are smaller areas that function in much the same way. You can also embed layers inside of subtabs/microtabs.
Subtabs are defined by using the tab format like this, where each element of tabFormat is given the name of that subtab:
```js
2020-10-26 20:45:22 +00:00
tabFormat: {
"Main tab": {
2020-10-29 18:57:42 +00:00
content: [tab format things],
2020-10-26 20:45:22 +00:00
*subtab features*
},
2020-10-26 20:45:22 +00:00
"Other tab": {
2020-10-29 18:57:42 +00:00
content: [tab format things],
2020-10-26 20:45:22 +00:00
*subtab features*
},
etc
}
```
2020-10-26 20:45:22 +00:00
Microtabs are defined similarly, and use the same features, but are defined in the "microtabs" feature. Each entry is a group of tabs which will appear in a microtabs component. The first set, "stuff", has 2 tabs, and the second, "otherStuff", has none.
```js
2020-10-26 20:45:22 +00:00
microtabs: {
stuff: {
first: {
2020-10-29 18:57:42 +00:00
content: [tab format things],
*subtab features*
},
2020-10-26 20:45:22 +00:00
second: {
2020-10-29 18:57:42 +00:00
content: [tab format things],
2020-10-26 20:45:22 +00:00
*subtab features*
}
},
2020-10-26 20:45:22 +00:00
otherStuff: {
// There could be another set of microtabs here
}
}
```
Normal subtabs and microtab subtabs both use the same features:
# Features:
2020-10-26 20:45:22 +00:00
- content: The tab layout code for the subtab, in [the tab layout format](custom-tab-layouts.md).
2020-10-26 20:45:22 +00:00
- style: **optional**. Applies CSS to the whole subtab when switched to, in the form of an "CSS Object", where the keys are CSS attributes, and the values are the values for those attributes (both as strings).
2020-10-26 20:45:22 +00:00
- buttonStyle: **optional**. A CSS object, which affects the appearance of the button for that subtab.
2020-10-26 20:45:22 +00:00
- unlocked(): **optional**. a function to determine if the button for this subtab should be visible. By default, a subtab is always unlocked. You can't use the "this" keyword in this function.
2020-10-27 23:25:03 +00:00
2021-04-29 22:33:12 +00:00
- shouldNotify()/prestigeNotify(): **optional**, if true, the tab button will be highlighted to notify the player that there is something there.
2020-10-27 23:25:03 +00:00
- embedLayer: **SIGNIFICANT**, the id of another layer. If you have this, it will override "content", "style" and "shouldNotify",
instead displaying the entire layer in the subtab.