Tabs
A set of layered sections of content that are displayed one at a time.
Tab bar
Usage
vue
<script setup lang="ts">
import { ref } from 'vue';
import { Tab, TabsBar } from '@youcan/ui-vue3';
const activeTab = ref(0);
function setActiveTab(id: number) {
activeTab.value = id;
}
</script>
<template>
<div class="tab-group">
<ul class="tab-list">
<TabsBar>
<Tab
label="For You"
:active="activeTab === 0"
@click="setActiveTab(0)"
/>
<Tab
label="Following"
:active="activeTab === 1"
@click="setActiveTab(1)"
/>
</TabsBar>
</ul>
<div class="tab-panels">
<div
v-show="activeTab === 0"
class="panel"
>
<p>Tab content</p>
</div>
<div
v-show="activeTab === 1"
class="panel"
>
<p>Tab content 2</p>
</div>
</div>
</div>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
API Reference
Tabs
Usage
vue
<script setup lang="ts">
import { ref } from 'vue';
import { Tab } from '@youcan/ui-vue3';
const activeTab = ref(0);
function setActiveTab(id: number) {
activeTab.value = id;
}
</script>
<template>
<TabsBar>
<Tab
label="For You"
:active="activeTab === 0"
@click="setActiveTab(0)"
/>
<Tab
label="Following"
:active="activeTab === 1"
@click="setActiveTab(1)"
/>
</TabsBar>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25