Split Panel

v0.3.5

Two-panel layout with a scrollable navigation list and a main content panel. Includes list item, list header, and empty-detail helper components.

View as Markdown

Install

npx shadcn@latest add @signalos/split-panel

Requires a configured @signalos registry and a valid SIGNALOS_REGISTRY_TOKEN - get access. Registry dependencies (@signalos/tokens, @signalos/utils, @signalos/tooltip) are pulled automatically.

Preview

Example & code

split-panel.example.tsx
import { useState } from "react"

import {
  SplitPanel,
  SplitPanelEmptyDetail,
  SplitPanelListHeader,
  SplitPanelListItem,
} from "./SplitPanel"

const contacts = [
  { id: "1", name: "Ada Lovelace", subtitle: "Engineering" },
  { id: "2", name: "Grace Hopper", subtitle: "Engineering" },
  { id: "3", name: "Margaret Hamilton", subtitle: "Product" },
]

export default function Example() {
  const [activeId, setActiveId] = useState<string | null>(null)
  const active = contacts.find((c) => c.id === activeId)

  return (
    <div className="h-96">
      <SplitPanel
        listWidth="w-72"
        list={
          <>
            <SplitPanelListHeader title="Contacts" />

            {contacts.map((contact) => (
              <SplitPanelListItem
                key={contact.id}
                title={contact.name}
                subtitle={contact.subtitle}
                active={contact.id === activeId}
                onClick={() => setActiveId(contact.id)}
              />
            ))}
          </>
        }
        detail={
          active ? (
            <div className="p-6">
              <h2 className="text-lg font-semibold">{active.name}</h2>
              <p className="text-sm text-muted-foreground">{active.subtitle}</p>
            </div>
          ) : (
            <SplitPanelEmptyDetail />
          )
        }
      />
    </div>
  )
}

Props

SplitPanelListItemProps

PropTypeDefaultDescription
title*ReactNode-Primary label for the item.
subtitleReactNode-Secondary line under the title.
iconReactNode-Leading icon or avatar.
badgeReactNode-Trailing badge/status indicator.
activeboolean | undefined-Marks the item as the currently selected one.
onClick(() => void) | undefined-
data-testidstring | undefined-Test identifier rendered as `data-testid` on the root element.

SplitPanelListHeaderProps

PropTypeDefaultDescription
titleReactNode-Header title.
actionsReactNode-Trailing actions (buttons, icons, etc.).
classNamestring | undefined-
data-testidstring | undefined-Test identifier rendered as `data-testid` on the root element.

SplitPanelEmptyDetailProps

PropTypeDefaultDescription
messageReactNode-Message shown when no item is selected.
classNamestring | undefined-
data-testidstring | undefined-Test identifier rendered as `data-testid` on the root element.

SplitPanelProps

PropTypeDefaultDescription
list*ReactNode-Left panel content.
detail*ReactNode-Main panel content.
listWidthstring | undefined-Width utility class for the left panel. Example: "w-64" "w-72" "w-80"
classNamestring | undefined-Additional classes.
data-testidstring | undefined-Test identifier rendered as `data-testid` on the root element.

Changelog

0.3.5

  • Content updates.

0.3.3

  • Content updates.

split-panel

0.3.1

  • Breaking: rename the testId prop to data-testid to match the rest of the registry and the DOM attribute name.

0.2.3

  • Format source with the repo prettier config (no behavior change).

0.2.2

  • Content sync fix to bring source in line with published registry payload.
  • Flattened components/ subfolder into the widget root (SplitPanelListItem, SplitPanelListHeader, SplitPanelEmptyDetail).
  • Fixed manifest: corrected description, dropped unused lucide-react/@signalos/button/@signalos/tooltip dependencies, fixed types file path (.ts, not .tsx), listed all shipped files, category layout.
  • Rewrote .example.tsx, .preview.tsx, and .test.tsx to exercise SplitPanel (previously copied from icon-button).

0.1.0

  • Initial release.