Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 560adb8

Browse files
Splaktarmmalerba
authored andcommitted
docs(tabs): clean up and refinements (#11290)
- add link to md-tab Closes #10947
1 parent 6b3afbb commit 560adb8

File tree

1 file changed

+41
-25
lines changed

1 file changed

+41
-25
lines changed

Diff for: src/components/tabs/js/tabsDirective.js

+41-25
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
* @restrict E
77
*
88
* @description
9-
* The `<md-tabs>` directive serves as the container for 1..n `<md-tab>` child directives to
10-
* produces a Tabs components. In turn, the nested `<md-tab>` directive is used to specify a tab
11-
* label for the **header button** and a [optional] tab view content that will be associated with
12-
* each tab button.
9+
* The `<md-tabs>` directive serves as the container for 1..n
10+
* <a ng-href="api/directive/mdTab">`<md-tab>`</a> child directives.
11+
* In turn, the nested `<md-tab>` directive is used to specify a tab label for the
12+
* **header button** and <i>optional</i> tab view content that will be associated with each tab
13+
* button.
1314
*
1415
* Below is the markup for its simplest usage:
1516
*
@@ -21,20 +22,20 @@
2122
* </md-tabs>
2223
* </hljs>
2324
*
24-
* Tabs supports three (3) usage scenarios:
25+
* Tabs support three (3) usage scenarios:
2526
*
2627
* 1. Tabs (buttons only)
2728
* 2. Tabs with internal view content
2829
* 3. Tabs with external view content
2930
*
30-
* **Tab-only** support is useful when tab buttons are used for custom navigation regardless of any
31+
* **Tabs-only** support is useful when tab buttons are used for custom navigation regardless of any
3132
* other components, content, or views.
3233
*
33-
* <i><b>Note:</b> If you are using the Tabs component for page-level navigation, please take a look
34-
* at the <a ng-href="./api/directive/mdNavBar">NavBar component</a> instead as it can handle this
35-
* case a bit more natively.</i>
34+
* <i><b>Note:</b> If you are using the Tabs component for page-level navigation, please use
35+
* the <a ng-href="./api/directive/mdNavBar">NavBar component</a> instead. It handles this
36+
* case a more natively and more performantly.</i>
3637
*
37-
* **Tabs with internal views** are the traditional usages where each tab has associated view
38+
* **Tabs with internal views** are the traditional usage where each tab has associated view
3839
* content and the view switching is managed internally by the Tabs component.
3940
*
4041
* **Tabs with external view content** is often useful when content associated with each tab is
@@ -47,33 +48,48 @@
4748
*
4849
* ### Explanation of tab stretching
4950
*
50-
* Initially, tabs will have an inherent size. This size will either be defined by how much space is needed to accommodate their text or set by the user through CSS. Calculations will be based on this size.
51+
* Initially, tabs will have an inherent size. This size will either be defined by how much space
52+
* is needed to accommodate their text or set by the user through CSS.
53+
* Calculations will be based on this size.
5154
*
52-
* On mobile devices, tabs will be expanded to fill the available horizontal space. When this happens, all tabs will become the same size.
55+
* On mobile devices, tabs will be expanded to fill the available horizontal space.
56+
* When this happens, all tabs will become the same size.
5357
*
5458
* On desktops, by default, stretching will never occur.
5559
*
56-
* This default behavior can be overridden through the `md-stretch-tabs` attribute. Here is a table showing when stretching will occur:
60+
* This default behavior can be overridden through the `md-stretch-tabs` attribute.
61+
* Here is a table showing when stretching will occur:
5762
*
5863
* `md-stretch-tabs` | mobile | desktop
5964
* ------------------|-----------|--------
6065
* `auto` | stretched | ---
6166
* `always` | stretched | stretched
6267
* `never` | --- | ---
6368
*
64-
* @param {integer=} md-selected Index of the active/selected tab
69+
* @param {integer=} md-selected Index of the active/selected tab.
6570
* @param {boolean=} md-no-ink If present, disables ink ripple effects.
6671
* @param {boolean=} md-no-ink-bar If present, disables the selection ink bar.
67-
* @param {string=} md-align-tabs Attribute to indicate position of tab buttons: `bottom` or `top`; default is `top`
68-
* @param {string=} md-stretch-tabs Attribute to indicate whether or not to stretch tabs: `auto`, `always`, or `never`; default is `auto`
69-
* @param {boolean=} md-dynamic-height When enabled, the tab wrapper will resize based on the contents of the selected tab
70-
* @param {boolean=} md-border-bottom If present, shows a solid `1px` border between the tabs and their content
71-
* @param {boolean=} md-center-tabs When enabled, tabs will be centered provided there is no need for pagination
72-
* @param {boolean=} md-no-pagination When enabled, pagination will remain off
73-
* @param {boolean=} md-swipe-content When enabled, swipe gestures will be enabled for the content area to jump between tabs
74-
* @param {boolean=} md-enable-disconnect When enabled, scopes will be disconnected for tabs that are not being displayed. This provides a performance boost, but may also cause unexpected issues and is not recommended for most users.
75-
* @param {boolean=} md-autoselect When present, any tabs added after the initial load will be automatically selected
76-
* @param {boolean=} md-no-select-click When enabled, click events will not be fired when selecting tabs
72+
* @param {string=} md-align-tabs Attribute to indicate position of tab buttons: `bottom` or `top`;
73+
* Default is `top`.
74+
* @param {string=} md-stretch-tabs Attribute to indicate whether or not to stretch tabs: `auto`,
75+
* `always`, or `never`; Default is `auto`.
76+
* @param {boolean=} md-dynamic-height When enabled, the tab wrapper will resize based on the
77+
* contents of the selected tab.
78+
* @param {boolean=} md-border-bottom If present, shows a solid `1px` border between the tabs and
79+
* their content.
80+
* @param {boolean=} md-center-tabs When enabled, tabs will be centered provided there is no need
81+
* for pagination.
82+
* @param {boolean=} md-no-pagination When enabled, pagination will remain off.
83+
* @param {boolean=} md-swipe-content When enabled, swipe gestures will be enabled for the content
84+
* area to allow swiping between tabs.
85+
* @param {boolean=} md-enable-disconnect When enabled, scopes will be disconnected for tabs that
86+
* are not being displayed. This provides a performance boost, but may also cause unexpected
87+
* issues. It is not recommended for most users.
88+
* @param {boolean=} md-autoselect When present, any tabs added after the initial load will be
89+
* automatically selected.
90+
* @param {boolean=} md-no-select-click When true, click events will not be fired when the value of
91+
* `md-active` on an `md-tab` changes. This is useful when using tabs with UI-Router's child
92+
* states, as triggering a click event in that case can cause an extra tab change to occur.
7793
*
7894
* @usage
7995
* <hljs lang="html">
@@ -147,7 +163,7 @@ function MdTabs ($$mdSvgRegistry) {
147163
'ng-repeat="tab in $mdTabsCtrl.tabs" ' +
148164
'role="tab" ' +
149165
'id="tab-item-{{::tab.id}}" ' +
150-
'md-tab-id="{{::tab.id}}"' +
166+
'md-tab-id="{{::tab.id}}" ' +
151167
'aria-selected="{{tab.isActive()}}" ' +
152168
'aria-disabled="{{tab.scope.disabled || \'false\'}}" ' +
153169
'ng-click="$mdTabsCtrl.select(tab.getIndex())" ' +

0 commit comments

Comments
 (0)