Tabs
solid-ui/tabsFreeComponent
A tabs component
Live preview
live · rendered by the registry
Rendered by solid-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.solid-ui.com/r/tabs.jsonSource
1import type { ValidComponent } from "solid-js"2import { splitProps } from "solid-js"34import type { PolymorphicProps } from "@kobalte/core/polymorphic"5import * as TabsPrimitive from "@kobalte/core/tabs"67import { cn } from "~/lib/utils"89const Tabs = TabsPrimitive.Root1011type TabsListProps<T extends ValidComponent = "div"> = TabsPrimitive.TabsListProps<T> & {12 class?: string | undefined13}1415const TabsList = <T extends ValidComponent = "div">(16 props: PolymorphicProps<T, TabsListProps<T>>17) => {18 const [local, others] = splitProps(props as TabsListProps, ["class"])19 return (20 <TabsPrimitive.List21 class={cn(22 "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",23 local.class24 )}25 {...others}26 />27 )28}2930type TabsTriggerProps<T extends ValidComponent = "button"> = TabsPrimitive.TabsTriggerProps<T> & {31 class?: string | undefined32}3334const TabsTrigger = <T extends ValidComponent = "button">(35 props: PolymorphicProps<T, TabsTriggerProps<T>>36) => {37 const [local, others] = splitProps(props as TabsTriggerProps, ["class"])38 return (39 <TabsPrimitive.Trigger40 class={cn(41 "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[selected]:bg-background data-[selected]:text-foreground data-[selected]:shadow-sm",42 local.class43 )}44 {...others}45 />46 )47}4849type TabsContentProps<T extends ValidComponent = "div"> = TabsPrimitive.TabsContentProps<T> & {50 class?: string | undefined51}5253const TabsContent = <T extends ValidComponent = "div">(54 props: PolymorphicProps<T, TabsContentProps<T>>55) => {56 const [local, others] = splitProps(props as TabsContentProps, ["class"])57 return (58 <TabsPrimitive.Content59 class={cn(60 "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",61 local.class62 )}63 {...others}64 />65 )66}6768type TabsIndicatorProps<T extends ValidComponent = "div"> = TabsPrimitive.TabsIndicatorProps<T> & {69 class?: string | undefined70}7172const TabsIndicator = <T extends ValidComponent = "div">(73 props: PolymorphicProps<T, TabsIndicatorProps<T>>74) => {75// … truncated
What it pulls in
npm packages
Files it writes
More from solid-ui
All 55 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | solid-ui | Components | Free | 2 deps | |
| Alertalert | solid-ui | Components | Free | 3 deps | |
| Alert Dialogalert-dialog | solid-ui | Components | Free | 2 deps | |
| Aspect Ratioaspect-ratio | solid-ui | Components | Free | 1 dep | |
| Avataravatar | solid-ui | Components | Free | 2 deps | |
| Badgebadge | solid-ui | Components | Free | 2 deps | |
| Badge Deltabadge-delta | solid-ui | Components | Free | 2 deps | |
| Bar Listbar-list | solid-ui | Components | Free | 1 dep |
