|
5 | 5 | <strong>Angular Tabs</strong> <small>underline</small> |
6 | 6 | </c-card-header> |
7 | 7 | <c-card-body> |
8 | | - <c-nav variant="underline-border" role="tablist"> |
9 | | - <c-nav-item> |
10 | | - <button [cTabContent]="tabContent1" [tabPaneIdx]="0" cNavLink > |
| 8 | + <c-tabs [activeItemKey]="0" (activeItemKeyChange)="handleActiveItemChange($event)"> |
| 9 | + <c-tabs-list variant="underline-border"> |
| 10 | + <button cTab [itemKey]="0"> |
11 | 11 | <svg cIcon class="me-2" name="cilHome"></svg> |
12 | 12 | Home |
13 | 13 | </button> |
14 | | - </c-nav-item> |
15 | | - <c-nav-item> |
16 | | - <button [cTabContent]="tabContent1" [tabPaneIdx]="1" cNavLink > |
| 14 | + <button cTab [itemKey]="1"> |
17 | 15 | <svg cIcon class="me-2" name="cilUser"></svg> |
18 | 16 | Profile |
19 | 17 | </button> |
20 | | - </c-nav-item> |
21 | | - <c-nav-item> |
22 | | - <button [cTabContent]="tabContent1" [tabPaneIdx]="2" cNavLink |
23 | | - [disabled]="tabContent1.activeTabPaneIdx < 1" > |
| 18 | + <button cTab [itemKey]="2" [disabled]="activeItem()===0"> |
24 | 19 | <svg cIcon class="me-2" name="cilCode"></svg> |
25 | 20 | Contact |
26 | 21 | </button> |
27 | | - </c-nav-item> |
28 | | - </c-nav> |
29 | | - <c-tab-content #tabContent1="cTabContent" [activeTabPaneIdx]="0" cRounded="bottom"> |
30 | | - <c-tab-pane class="p-3 preview" > |
31 | | - This is some placeholder content the <strong>Home</strong> tab's associated content. Clicking another tab |
32 | | - will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
33 | | - content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
34 | | - </c-tab-pane> |
35 | | - <c-tab-pane class="p-3 preview" > |
36 | | - This is some placeholder content the <strong>Profile</strong> tab's associated content. Clicking another |
37 | | - tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
38 | | - content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
39 | | - </c-tab-pane> |
40 | | - @if (tabContent1.activeTabPaneIdx > 0) { |
41 | | - <c-tab-pane class="p-3 preview" > |
42 | | - This is some placeholder content the <strong>Contact</strong> tab's associated content. Clicking another |
43 | | - tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
44 | | - content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
45 | | - </c-tab-pane> |
46 | | - } |
47 | | - </c-tab-content> |
| 22 | + </c-tabs-list> |
| 23 | + <c-tabs-content> |
| 24 | + <c-tab-panel [itemKey]="0" class="p-3"> |
| 25 | + This is some placeholder content the <strong class="text-info">Home</strong> tab's associated content. Clicking another tab |
| 26 | + will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
| 27 | + content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
| 28 | + </c-tab-panel> |
| 29 | + <c-tab-panel [itemKey]="1" class="p-3"> |
| 30 | + This is some placeholder content the <strong class="text-success">Profile</strong> tab's associated content. Clicking another |
| 31 | + tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
| 32 | + content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
| 33 | + </c-tab-panel> |
| 34 | + <c-tab-panel [itemKey]="2" class="p-3"> |
| 35 | + This is some placeholder content the <strong class="text-warning">Contact</strong> tab's associated content. Clicking another |
| 36 | + tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
| 37 | + content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
| 38 | + </c-tab-panel> |
| 39 | + </c-tabs-content> |
| 40 | + </c-tabs> |
48 | 41 | </c-card-body> |
49 | 42 | </c-card> |
50 | 43 | </c-col> |
|
54 | 47 | <strong>Angular Tabs</strong> <small>tabs</small> |
55 | 48 | </c-card-header> |
56 | 49 | <c-card-body> |
57 | | - <c-nav variant="tabs" role="tablist"> |
58 | | - @for (nav of panes; track nav; let i = $index, isLast = $last) { |
59 | | - <c-nav-item> |
60 | | - <button [cTabContent]="tabContent2" [disabled]="isLast" [tabPaneIdx]="i" cNavLink > |
61 | | - <svg cIcon class="me-2" [name]="nav.icon"></svg> |
62 | | - {{ nav.name }} |
| 50 | + <c-tabs [activeItemKey]="0"> |
| 51 | + <c-tabs-list variant="tabs"> |
| 52 | + @for (tab of panes; track i; let i = $index, isLast = $last) { |
| 53 | + <button cTab [itemKey]="i" [disabled]="isLast"> |
| 54 | + <svg cIcon class="me-2" [name]="tab.icon"></svg> |
| 55 | + {{ tab.name }} |
63 | 56 | </button> |
64 | | - </c-nav-item> |
65 | | - } |
66 | | - </c-nav> |
67 | | - <c-tab-content #tabContent2="cTabContent" [activeTabPaneIdx]="0" cRounded="bottom"> |
68 | | - @for (pane of panes; track pane; let i = $index) { |
69 | | - <c-tab-pane class="p-3 preview" > |
70 | | - This is some placeholder content the <strong>{{ pane.name }}</strong> tab's associated content. Clicking |
71 | | - another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to |
72 | | - control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered |
73 | | - navigation. |
74 | | - </c-tab-pane> |
75 | | - } |
76 | | - </c-tab-content> |
| 57 | + } |
| 58 | + </c-tabs-list> |
| 59 | + <c-tabs-content> |
| 60 | + @for (pane of panes; track i; let i = $index) { |
| 61 | + <c-tab-panel class="p-3 preview" [itemKey]="i" cRounded="bottom"> |
| 62 | + This is some placeholder content the <strong>{{ pane.name }}</strong> tab's associated content. Clicking |
| 63 | + another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to |
| 64 | + control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered |
| 65 | + navigation. |
| 66 | + </c-tab-panel> |
| 67 | + } |
| 68 | + </c-tabs-content> |
| 69 | + </c-tabs> |
77 | 70 | </c-card-body> |
78 | 71 | </c-card> |
79 | 72 | </c-col> |
|
83 | 76 | <strong>Angular Tabs</strong> <small>pills</small> |
84 | 77 | </c-card-header> |
85 | 78 | <c-card-body> |
86 | | - <c-nav variant="pills" role="tablist"> |
87 | | - <c-nav-item> |
88 | | - <button [cTabContent]="tabContent3" [tabPaneIdx]="0" cNavLink > |
| 79 | + <c-tabs> |
| 80 | + <c-tabs-list variant="pills"> |
| 81 | + <button cTab [itemKey]="0"> |
89 | 82 | <svg cIcon class="me-2" name="cilHome"></svg> |
90 | 83 | Home |
91 | 84 | </button> |
92 | | - </c-nav-item> |
93 | | - <c-nav-item> |
94 | | - <button [cTabContent]="tabContent3" [tabPaneIdx]="1" cNavLink > |
| 85 | + <button cTab [itemKey]="1"> |
95 | 86 | <svg cIcon class="me-2" name="cilUser"></svg> |
96 | 87 | Profile |
97 | 88 | </button> |
98 | | - </c-nav-item> |
99 | | - <c-nav-item> |
100 | | - <button [cTabContent]="tabContent3" [tabPaneIdx]="2" cNavLink > |
| 89 | + <button cTab [itemKey]="2"> |
101 | 90 | <svg cIcon class="me-2" name="cilCode"></svg> |
102 | 91 | Contact |
103 | 92 | </button> |
104 | | - </c-nav-item> |
105 | | - </c-nav> |
106 | | - <c-tab-content #tabContent3="cTabContent" cRounded="bottom" [activeTabPaneIdx]="0"> |
107 | | - <c-tab-pane aria-labelledby="docs-code-preview" class="p-3 preview" > |
108 | | - This is some placeholder content the <strong>Home</strong> tab's associated content. Clicking another tab |
109 | | - will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
110 | | - content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
111 | | - </c-tab-pane> |
112 | | - <c-tab-pane aria-labelledby="docs-code-preview" class="p-3 preview" > |
113 | | - This is some placeholder content the <strong>Profile</strong> tab's associated content. Clicking another |
114 | | - tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
115 | | - content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
116 | | - </c-tab-pane> |
117 | | - <c-tab-pane aria-labelledby="docs-code-preview" class="p-3 preview" > |
118 | | - This is some placeholder content the <strong>Contact</strong> tab's associated content. Clicking another |
119 | | - tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
120 | | - content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
121 | | - </c-tab-pane> |
122 | | - </c-tab-content> |
| 93 | + </c-tabs-list> |
| 94 | + <c-tabs-content> |
| 95 | + <c-tab-panel [itemKey]="0" class="p-3"> |
| 96 | + This is some placeholder content the <strong>Home</strong> tab's associated content. Clicking another tab |
| 97 | + will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
| 98 | + content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
| 99 | + </c-tab-panel> |
| 100 | + <c-tab-panel [itemKey]="1" class="p-3"> |
| 101 | + This is some placeholder content the <strong>Profile</strong> tab's associated content. Clicking another |
| 102 | + tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
| 103 | + content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
| 104 | + </c-tab-panel> |
| 105 | + <c-tab-panel [itemKey]="2" class="p-3"> |
| 106 | + This is some placeholder content the <strong>Contact</strong> tab's associated content. Clicking another |
| 107 | + tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the |
| 108 | + content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation. |
| 109 | + </c-tab-panel> |
| 110 | + </c-tabs-content> |
| 111 | + </c-tabs> |
123 | 112 | </c-card-body> |
124 | 113 | </c-card> |
125 | 114 | </c-col> |
|
0 commit comments