Skip to content

Networks & maps

What connects to what and where: rings out from one thing, hubs and lanes, a globe of arcs and a map of regions.

Installation & usage

npx @youj/cli add app-radial-network

Also installs alert, button, card, empty, radial-graph, segmented-control, skeleton, typography, use-controllable-state, youj-core, youj-ui-core.

The CLI copies the block to blocks/app/radial-network.tsx with every component it uses, so it’s yours to edit.

Every prop is optional and falls back to the demo, so it renders as you see it until you pass your own. Give it your data, rewrite or translate its strings through copy, and connect its actions:

radialNetwork-view.tsx
'use client'

import { RadialNetwork, type RadialNetworkProps } from '@/blocks/app/radial-network'

export function RadialNetworkView({ center, nodes, kinds, states }: Pick<RadialNetworkProps, 'center' | 'nodes' | 'kinds' | 'states'>) {
  return (
    <RadialNetwork
      center={center}
      nodes={nodes}
      kinds={kinds}
      states={states}
      copy={{ title: 'Blast radius' }}
      onRetry={() => {
        // your code
      }}
      onHopsChange={(hops) => {
        // your code
      }}
    />
  )
}

Reference

Props17 props, 4 types

Props

RadialNetwork props
PropType
themeThemeInput

Wraps the card in this theme. Default: the theme around it.

–
embeddedboolean

Inside another app: a section named by an h2, without the page around the card.

default true

true
fillboolean

Take the whole width it's given instead of stopping at its natural width (448px at 100% scale).

default false

false
copyPartial<RadialNetworkCopy>

Any of the card's strings, to rewrite or translate.

–
localestring

Formats the counts (BCP 47). Default: the app's locale (YoujProvider), else en-US.

–
centerRadialNetworkCenter

Where it starts.

default demo

demo
nodesRadialNetworkNode[]

Everything it reaches, each hanging from its via or from the center.

default demo

demo
kindsRadialNetworkKind[]

The kinds of things, with their colors, in the key's order.

default demo

demo
statesRadialNetworkState[]

The states a node can be in, with their rings, in the key's order.

default compromised, at risk, clean

compromised, at risk, clean
format(value: number) => string

Formats the foot's counts. Default: the locale's number format.

–
loadingboolean

Skeletons in place of the graph while your data loads.

default false

false
errorstring

Shown in place of the graph when it fails to load, with Retry when onRetry is set.

–
onRetry() => void

Retries after an error.

–
emptyReactNode

Replaces the message when there is nothing to draw. Default: copy.emptyTitle and copy.emptyDescription.

–
hopsnumber

How many hops to show, controlled.

–
defaultHopsnumber

How many hops to show at first. Default: all of them.

–
onHopsChange(hops: number) => void

Called with the hops picked in the header.

–

RadialNetworkCenter

RadialNetworkCenter props
PropType
idRequiredstring–
nameRequiredstring–
shortstring

Up to three characters in the center's disc. Default: the name's initials.

–
kindRequiredstring–
statestring

A RadialNetworkState id. Default: none, a plain node.

–

RadialNetworkKind

RadialNetworkKind props
PropType
idRequiredstring–
labelRequiredstring–
toneRequiredRadialNetworkTone
'accent''neutral''chart-1''chart-2''chart-3''chart-4''chart-5'
–

RadialNetworkNode

RadialNetworkNode props
PropType
idRequiredstring–
nameRequiredstring

As your tooling names it, set in mono in its tooltip: "lt-moreau".

–
kindRequiredstring

A RadialNetworkKind id.

–
viastring

The node it is reached through, one hop in. Default: the center.

–
statestring

A RadialNetworkState id. Default: none, a plain node.

–
notestring

Why it is in that state, in its tooltip: "Readable with the new token".

–

RadialNetworkState

RadialNetworkState props
PropType
idRequiredstring–
labelRequiredstring–
ring'solid' | 'dashed'

The ring the node wears, and how the link into it is drawn. Default: none.

–
tone'accent' | 'info' | 'success' | 'warning' | 'danger'

The ring's color.

default 'danger'

'danger'
countboolean

Counted in the foot, in this order.

–
emphasisboolean

The foot's figure for it in the state's color.

–
Strings13 keys for copy

Strings

copy takes any of these keys; the rest keep their defaults. A key whose text holds a value (a count, a name) takes a function.

titlesubtitlehopsLabelhopsgraphLabelstatesLabelkindsLabeltotalloadingLabelerrorTitleretryemptyTitleemptyDescription
Built from8 components
Accessibilityimages, radio groups, tables, motion

Accessibility

Radial network picks its hops with one named choice and draws the graph as a named group described by how many things are reached within the hops shown. Every node is in a list, named with its distance ("invoice-exports, 2 hops away") and described by its state and note; the graph is one tab stop, the arrow keys walk the rings and follow links, and focus shows the same tooltip hovering does. States are words and solid or dashed rings, never color alone, and the foot's counts are a description list.

On the hubs map the drawing is aria-hidden and the hubs are a labelled radio group: each hub is named with its figures, and the arrow keys walk west to east. Each lane in the panel has a spoken label with its direction, volume and travel time.

The arc globe is an image with a text summary, drawn on a canvas that is aria-hidden; its figures are also in a visually hidden table and the lists beside it. Regions and places are aria-pressed toggles, places are named with their share, and the period and site controls and the Live toggle are labelled. The feed of latest visits has a heading.

The region map makes the table the source of truth for the dot map: the map is an image with a summary, rows are named, and each region's Show on map button has aria-pressed. The range control and Live toggle are labelled.

Under reduced motion the globe is a single still frame and values change in place.