summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/ui/src/components/tabs.css66
-rw-r--r--packages/ui/src/components/tabs.tsx5
2 files changed, 70 insertions, 1 deletions
diff --git a/packages/ui/src/components/tabs.css b/packages/ui/src/components/tabs.css
index d60edc5c5..3ec7ece90 100644
--- a/packages/ui/src/components/tabs.css
+++ b/packages/ui/src/components/tabs.css
@@ -205,4 +205,70 @@
/* [data-slot="tabs-content"] { */
/* } */
}
+
+ &[data-orientation="vertical"] {
+ flex-direction: row;
+
+ [data-slot="tabs-list"] {
+ flex-direction: column;
+ width: auto;
+ height: 100%;
+ overflow-x: hidden;
+ overflow-y: auto;
+
+ &::after {
+ width: 100%;
+ height: auto;
+ flex-grow: 1;
+ border-bottom: none;
+ border-right: 1px solid var(--border-weak-base);
+ }
+ }
+
+ [data-slot="tabs-trigger-wrapper"] {
+ width: 100%;
+ height: auto;
+ border-bottom: none;
+ border-right: 1px solid var(--border-weak-base);
+
+ &:has([data-selected]) {
+ border-right-color: transparent;
+ }
+ }
+
+ [data-slot="tabs-content"] {
+ overflow-x: auto;
+ overflow-y: auto;
+ }
+
+ &[data-variant="alt"] {
+ [data-slot="tabs-list"] {
+ padding-left: 0;
+ padding-right: 0;
+ padding-top: 24px;
+ padding-bottom: 24px;
+ border-bottom: none;
+ border-right: 1px solid var(--border-weak-base);
+
+ &::after {
+ border: none;
+ }
+ }
+
+ [data-slot="tabs-trigger-wrapper"] {
+ border-bottom: none;
+ border-right-width: 2px;
+ border-right-style: solid;
+ border-right-color: transparent;
+
+ [data-slot="tabs-trigger"] {
+ border-bottom: none;
+ }
+
+ &:has([data-selected]) {
+ border-right-color: var(--icon-strong-base);
+ }
+ }
+ }
+ }
}
diff --git a/packages/ui/src/components/tabs.tsx b/packages/ui/src/components/tabs.tsx
index d91ad3c41..0a4d5b91a 100644
--- a/packages/ui/src/components/tabs.tsx
+++ b/packages/ui/src/components/tabs.tsx
@@ -4,6 +4,7 @@ import type { ComponentProps, ParentProps } from "solid-js"
export interface TabsProps extends ComponentProps<typeof Kobalte> {
variant?: "normal" | "alt"
+ orientation?: "horizontal" | "vertical"
}
export interface TabsListProps extends ComponentProps<typeof Kobalte.List> {}
export interface TabsTriggerProps extends ComponentProps<typeof Kobalte.Trigger> {
@@ -16,12 +17,14 @@ export interface TabsTriggerProps extends ComponentProps<typeof Kobalte.Trigger>
export interface TabsContentProps extends ComponentProps<typeof Kobalte.Content> {}
function TabsRoot(props: TabsProps) {
- const [split, rest] = splitProps(props, ["class", "classList", "variant"])
+ const [split, rest] = splitProps(props, ["class", "classList", "variant", "orientation"])
return (
<Kobalte
{...rest}
+ orientation={split.orientation}
data-component="tabs"
data-variant={split.variant || "normal"}
+ data-orientation={split.orientation || "horizontal"}
classList={{
...(split.classList ?? {}),
[split.class ?? ""]: !!split.class,