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

Commit e115b95

Browse files
committed
feat(tabs): add custom styled variant
1 parent 499d37b commit e115b95

File tree

4 files changed

+112
-89
lines changed

4 files changed

+112
-89
lines changed

packages/c-tabs/examples/unstyled.vue

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<script setup lang="ts">
2+
import { ref } from "vue"
3+
import { chakra, CStack, useColorModeValue } from "../../vue/src"
4+
import {
5+
CTabs,
6+
CTabList,
7+
CTab,
8+
CTabPanel,
9+
CTabPanels,
10+
CTabIndicator,
11+
} from "../src"
12+
13+
const value = ref("two")
14+
</script>
15+
16+
<template>
17+
<chakra.div data-testid="simple-tabs-example">
18+
<c-stack spacing="5">
19+
<c-heading size="md">Tabs - Unstyled</c-heading>
20+
<c-simple-grid template-rows="auto auto" gap="4">
21+
<c-stack
22+
spacing="5"
23+
rounded="8px"
24+
:border-color="
25+
useColorModeValue('blackAlpha.300', 'whiteAlpha.300').value
26+
"
27+
border-width="1px"
28+
border-style="solid"
29+
px="4"
30+
py="3"
31+
>
32+
<c-heading size="sm">With Indicator</c-heading>
33+
<c-tabs v-model="value" variant="unstyled">
34+
<c-tab-list>
35+
<c-tab value="one"> Item One </c-tab>
36+
<c-tab value="two"> Item Two </c-tab>
37+
<c-tab value="three"> Item Three </c-tab>
38+
</c-tab-list>
39+
<c-tab-indicator
40+
mt="-1.5px"
41+
height="2px"
42+
bg="pink.400"
43+
border-radius="1px"
44+
/>
45+
46+
<c-tab-panels>
47+
<c-tab-panel value="one"> Value Item 1 </c-tab-panel>
48+
<c-tab-panel value="two"> Value Item 2 </c-tab-panel>
49+
<c-tab-panel value="three"> Value Item 3 </c-tab-panel>
50+
</c-tab-panels>
51+
</c-tabs>
52+
</c-stack>
53+
<c-stack
54+
spacing="5"
55+
rounded="8px"
56+
:border-color="
57+
useColorModeValue('blackAlpha.300', 'whiteAlpha.300').value
58+
"
59+
border-width="1px"
60+
border-style="solid"
61+
px="4"
62+
py="3"
63+
>
64+
<c-heading size="sm">With Custom Style</c-heading>
65+
<c-tabs v-model="value" variant="unstyled">
66+
<c-tab-list>
67+
<c-tab
68+
:_selected="{ color: 'white', bg: 'blue.500' }"
69+
value="one"
70+
>
71+
Item One
72+
</c-tab>
73+
<c-tab
74+
:_selected="{ color: 'white', bg: 'green.500' }"
75+
value="two"
76+
>
77+
Item Two
78+
</c-tab>
79+
<c-tab
80+
:_selected="{ color: 'white', bg: 'orange.500' }"
81+
value="three"
82+
>
83+
Item Three
84+
</c-tab>
85+
</c-tab-list>
86+
87+
<c-tab-panels>
88+
<c-tab-panel value="one"> Value Item 1 </c-tab-panel>
89+
<c-tab-panel value="two"> Value Item 2 </c-tab-panel>
90+
<c-tab-panel value="three"> Value Item 3 </c-tab-panel>
91+
</c-tab-panels>
92+
</c-tabs>
93+
</c-stack>
94+
</c-simple-grid>
95+
</c-stack>
96+
</chakra.div>
97+
</template>

packages/c-tabs/examples/with-indicator.vue

-88
This file was deleted.

packages/c-tabs/examples/with-variants.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const value = ref("two")
2323
<template>
2424
<chakra.div data-testid="simple-tabs-example">
2525
<c-stack spacing="5">
26-
<c-heading size="md">Tabs - Basic</c-heading>
26+
<c-heading size="md">Tabs - with variants</c-heading>
2727
<c-simple-grid
2828
template-rows="auto auto"
2929
template-columns="auto auto"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`should render properly 1`] = `
4+
<DocumentFragment>
5+
<div
6+
class="chakra-tabs chakra-13o7eu2"
7+
data-orientation="horizontal"
8+
data-part="root"
9+
data-scope="tabs"
10+
dir="ltr"
11+
id="tabs:1"
12+
/>
13+
</DocumentFragment>
14+
`;

0 commit comments

Comments
 (0)