Layout

Tabs

Pill-in-pill tabbed surface.

Preview
85 poker sites tracked.
Install
npx shadcn@latest add https://ui.thjsecurity.tech/r/tabs.json

Pulls the component into components/ui/tabs.tsx and its token dependencies. The app owns the copy from then on.

Dependencies
@radix-ui/react-tabs
Source
"use client"

import * as React from "react"
import * as TabsPrimitive from "@radix-ui/react-tabs"

import { cn } from "@/lib/utils"

/* Segmented-control tabs, matching the `.seg` toggle used elsewhere (the
   Assets view switcher): a rounded track holding the options, the active one a
   lifted solid pill with a soft shadow, a small gap between the pills and the
   track edge. The console's section switcher, reusable for page sections
   (Settings, a customer's detail). */

const Tabs = TabsPrimitive.Root

const TabsList = React.forwardRef<
  React.ElementRef<typeof TabsPrimitive.List>,
  React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
>(({ className, ...props }, ref) => (
  <TabsPrimitive.List
    ref={ref}
    className={cn(
      "inline-flex max-w-full gap-[2px] overflow-x-auto rounded-xl border border-glass-border bg-glass p-[3px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
      className,
    )}
    {...props}
  />
))
TabsList.displayName = TabsPrimitive.List.displayName

const TabsTrigger = React.forwardRef<
  React.ElementRef<typeof TabsPrimitive.Trigger>,
  React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
>(({ className, ...props }, ref) => (
  <TabsPrimitive.Trigger
    ref={ref}
    className={cn(
      "inline-flex h-8 shrink-0 items-center gap-2 whitespace-nowrap rounded-[9px] px-3.5 text-[13px] font-semibold leading-none text-paper-dim transition-colors [&_svg]:shrink-0",
      "hover:text-paper-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-signal disabled:pointer-events-none disabled:opacity-50",
      "data-[state=active]:bg-seg-active data-[state=active]:text-seg-active-fg data-[state=active]:shadow-[var(--seg-active-shadow)]",
      className,
    )}
    {...props}
  />
))
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName

const TabsContent = React.forwardRef<
  React.ElementRef<typeof TabsPrimitive.Content>,
  React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
>(({ className, ...props }, ref) => (
  <TabsPrimitive.Content ref={ref} className={cn("mt-5 focus-visible:outline-none", className)} {...props} />
))
TabsContent.displayName = TabsPrimitive.Content.displayName

export { Tabs, TabsList, TabsTrigger, TabsContent }