separator
shadcn-solidjs/separatorFreeComponent
shadcn-solidjs publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shadcn-solidjs on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shadcn-solidjs.com/r/separator.jsonSource
1import type { PolymorphicProps } from "@kobalte/core/polymorphic";2import * as SeparatorPrimitive from "@kobalte/core/separator";34import { cn } from "~/lib/utils.ts";5import type { ValidComponent } from "solid-js";67import { splitProps } from "solid-js";89type SeparatorRootProps<T extends ValidComponent = "div"> =10 & SeparatorPrimitive.SeparatorRootProps<T>11 & {12 class?: string | undefined;13 decorative?: boolean | undefined;14 };1516const Separator = <T extends ValidComponent = "div">(17 props: PolymorphicProps<T, SeparatorRootProps<T>>,18) => {19 const [local, others] = splitProps(props as SeparatorRootProps, [20 "class",21 "orientation",22 "decorative",23 ]);24 const orientation = () => local.orientation ?? "horizontal";25 const decorative = () => local.decorative ?? true;26 // Rendered as a div like the upstream radix separator: tailwind's27 // preflight and typeset both style hr (stray top border, height: 0,28 // prose margins).29 //30 // Note that a vertical separator stretches instead of taking h-full: a31 // percentage height collapses to 0 inside a flex row that has no definite32 // height. Setting an explicit height on it defeats align-self: stretch33 // (the item falls back to flex-start), so pair a forced height with34 // self-center.35 //36 // Kobalte has no `decorative` prop and always announces the separator, so37 // the semantics are authored here instead of being derived from the38 // primitive's `orientation`: a decorative separator gets `role="none"` and39 // no `aria-orientation`, exactly like the radix one.40 return (41 <SeparatorPrimitive.Root42 as="div"43 data-slot="separator"44 data-orientation={orientation()}45 role={decorative() ? "none" : "separator"}46 aria-orientation={!decorative() && orientation() === "vertical"47 ? "vertical"48 : undefined}49 class={cn(50 "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",51 local.class,52 )}53 {...others}54 />55 );56};5758export { Separator };
What it pulls in
npm packages
More from shadcn-solidjs
All 85 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn-solidjs | Components | Free | 1 dep | |
| alertalert | shadcn-solidjs | Components | Free | 2 deps | |
| alert-dialogalert-dialog | shadcn-solidjs | Components | Free | 2 deps | |
| aspect-ratioaspect-ratio | shadcn-solidjs | Components | Free | no deps | |
| attachmentattachment | shadcn-solidjs | Components | Free | 2 deps | |
| avataravatar | shadcn-solidjs | Components | Free | 1 dep | |
| badgebadge | shadcn-solidjs | Components | Free | 2 deps | |
| breadcrumbbreadcrumb | shadcn-solidjs | Components | Free | 1 dep |
