Data Primitives

v0.1.1

Domain-agnostic presentational atoms for dense data surfaces: SectionLabel, MetaBox, EmptyState, TagList, and DataListRow. Pure props-in rendering, composable across any domain.

View as Markdown

Install

npx shadcn@latest add @signalos/data-primitives

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

Preview

Example & code

data-primitives.example.tsx
// Example: dense data atoms composed inside a detail-panel section.
import { Link2, Tag, Zap } from "lucide-react"

import {
  DataListRow,
  EmptyState,
  MetaBox,
  SectionLabel,
  TagList,
} from "@/components/widgets/data-primitives/DataPrimitives"
import { StatusBadge } from "@/components/widgets/status-badge/StatusBadge"

export default function Example() {
  return (
    <div className="flex max-w-md flex-col gap-4">
      <div>
        <SectionLabel icon={<Zap className="h-3 w-3" />}>
          Contributing metrics
        </SectionLabel>
        <div className="mt-2">
          <TagList
            items={[
              "coverage_rate",
              "latency_p95",
              "error_rate",
              "queue_depth",
            ]}
            max={3}
          />
        </div>
      </div>

      <div className="grid grid-cols-3 gap-2">
        <MetaBox label="Age" value="3d 1h" />
        <MetaBox label="Routed" value="+37s" />
        <MetaBox label="Signals" value="16" />
      </div>

      <div>
        <SectionLabel icon={<Link2 className="h-3 w-3" />}>
          Related
        </SectionLabel>
        <ul className="mt-2 flex flex-col gap-1.5">
          <DataListRow
            leading={<StatusBadge severity="high" appearance="chip" />}
            eyebrow="6E7F3696"
            primary="Coverage collapse across tenants"
            badges={[{ label: "EXPIRED" }]}
            meta="2d ago"
            onSelect={() => {}}
          />
        </ul>
      </div>

      <div>
        <SectionLabel icon={<Tag className="h-3 w-3" />}>
          Transfers
        </SectionLabel>
        <div className="mt-2">
          <EmptyState
            icon={<Tag className="h-5 w-5" />}
            label="No transfers recorded."
          />
        </div>
      </div>
    </div>
  )
}

Props

SectionLabelProps

PropTypeDefaultDescription
iconReactNode-Optional leading icon (typically a 12px lucide glyph).
children*ReactNode-Uppercased mono eyebrow text.
classNamestring | undefined-

MetaBoxProps

PropTypeDefaultDescription
label*ReactNode-Small uppercased caption.
value*ReactNode-Emphasised mono value.
classNamestring | undefined-

EmptyStateProps

PropTypeDefaultDescription
iconReactNode-Optional muted illustration/icon.
label*ReactNode-Primary message.
descriptionReactNode-Optional supporting copy under the label.
classNamestring | undefined-

TagListProps

PropTypeDefaultDescription
items*readonly ReactNode[]-Values rendered as mono code chips.
maxnumber | undefined-Cap the number of visible chips; the remainder collapses into a "+N" counter. Omit to show all.
classNamestring | undefined-

DataListRowBadge

PropTypeDefaultDescription
label*ReactNode-
variant"default" | "secondary" | "outline" | undefined"secondary"Maps to the underlying Badge variant.

DataListRowProps

PropTypeDefaultDescription
leadingReactNode-Leading slot — a status badge, icon, or severity chip.
eyebrowReactNode-Optional mono identifier shown before the primary text.
primary*ReactNode-Primary, truncating text.
badgesreadonly DataListRowBadge[] | undefined-Optional trailing pills (e.g. a status).
metaReactNode-Optional trailing meta (e.g. a relative timestamp).
onSelect(() => void) | undefined-Makes the row interactive with button semantics.
classNamestring | undefined-

Changelog

data-primitives

0.1.1

  • Add the missing "use client" directive - DataListRow wires onClick/onKeyDown, which crashes in a server-component tree without it.

0.1.0

  • Initial release, extracted from the attention-routing-01 block's local components. Ships five domain-agnostic atoms — SectionLabel, MetaBox, EmptyState, TagList, and DataListRow — as reusable, props-driven building blocks for dense data surfaces (cards, detail panels, list rows).