1+ <script >
2+
3+ /** @type {string} */
4+ export let containerClasses = " " ;
5+
6+ /** @type {string} */
7+ export let containerStyles = " " ;
8+
9+ /** @type {boolean} */
10+ export let disableDefaultContainerStyles = false ;
11+
12+ /** @type {string} */
13+ export let containerRole = " presentation" ;
14+
15+ /** @type {string} */
16+ export let containerId = " nav-item" ;
17+
18+ /** @type {string} */
19+ export let navBtnClasses = " " ;
20+
21+ /** @type {string} */
22+ export let navBtnStyles = " " ;
23+
24+ /** @type {boolean} */
25+ export let disableDefaultNavBtnStyles = false ;
26+
27+ /** @type {string} */
28+ export let navBtnRole = " tab" ;
29+
30+ /** @type {string} */
31+ export let navBtnId = " nav-item-id" ;
32+
33+ /** @type {string} */
34+ export let navBtnText;
35+
36+ /** @type {boolean} */
37+ export let active = false ;
38+
39+ /** @type {boolean} */
40+ export let disabled = false ;
41+
42+ /** @type {string} */
43+ export let dataBsToggle = " tab" ;
44+
45+ /** @type {string} */
46+ export let dataBsTarget = " #nav-item-pane" ;
47+
48+ /** @type {string} */
49+ export let ariaControls = " nav-item-tab-pane" ;
50+
51+ /** @type {() => void} */
52+ export let onClick = () => {};
53+
54+ /** @param {any} e */
55+ function handleTabClick (e ) {
56+ e .preventDefault ();
57+ onClick? .();
58+ }
59+ < / script>
60+
61+ < li
62+ class = " {disableDefaultContainerStyles ? '' : 'nav-item tab-item'} {containerClasses}"
63+ style= {` ${ containerStyles} ` }
64+ id= {containerId}
65+ role= {containerRole}
66+ >
67+ < button
68+ class = " {disableDefaultNavBtnStyles ? '' : 'nav-link tab-btn'} {navBtnClasses}"
69+ class : active= {active}
70+ style= {` ${ navBtnStyles} ` }
71+ id= {navBtnId}
72+ type= " button"
73+ role= {navBtnRole}
74+ data- bs- toggle= {dataBsToggle}
75+ data- bs- target= {dataBsTarget}
76+ aria- controls= {ariaControls}
77+ aria- selected= {` ${ active ? " true" : " false" } ` }
78+ disabled= {disabled}
79+ on: click= {(e ) => handleTabClick (e)}
80+ >
81+ {navBtnText}
82+ < / button>
83+ < / li>
84+
85+ < style>
86+ .tab - item {
87+ flex: 0 1 50 % ;
88+ }
89+
90+ .tab - btn {
91+ width: 100 % ;
92+ height: 100 % ;
93+ border: none ! important;
94+ color: white ! important;
95+ background- color: var (-- bs- secondary);
96+ font- weight: 500 ;
97+ font- size: 1 .2em ;
98+ }
99+
100+ .tab - btn .active {
101+ background- color: var (-- bs- primary) ! important;
102+ }
103+ < / style>
0 commit comments