# Connections

> The connections page of an assistant app: counts, every connected service with its account and sync state (one asks to reconnect), and the gallery of services to add, grouped by category with search.

Pattern · Halo kit · [Live page](https://ui.twentyfirst.media/halo/patterns/ConnectionsScreen/)

The connections page of an assistant app: counts, every connected service with its account and
sync state (one asks to reconnect), and the gallery of services to add, grouped by category with
search. Every service shows its brand logo from the icon library.

## Code

```tsx
import type * as React from "react";
import {
  AppShell,
  Button,
  ConnectionList,
  ConnectorGallery,
  PageHeader,
  Panel,
  Stagger,
  StatTile,
} from "@twentyfirstmedia/halo";
import type { ConnectionItem, SidebarGroup } from "@twentyfirstmedia/halo";
import { CATEGORIES, CONNECTORS } from "./_connectors";

const NAV: SidebarGroup[] = [
  {
    items: [
      { id: "today", label: "Today", icon: "sun" },
      { id: "assistant", label: "Assistant", icon: "sparkle" },
    ],
  },
  {
    label: "Agents",
    items: [
      { id: "connections", label: "Connections", icon: "link" },
      { id: "activity", label: "Activity", icon: "list", badge: "1" },
      { id: "access", label: "Data access", icon: "shield" },
    ],
  },
];

const now = new Date(2026, 10, 14, 9, 30);
const ago = (m: number) => new Date(now.getTime() - m * 60000);

const CONNECTED: ConnectionItem[] = [
  {
    id: "gmail",
    name: "Gmail",
    icon: "brandGmail",
    account: "mara@gmail.com",
    state: "connected",
    sync: { state: "synced", last: ago(6) },
  },
  {
    id: "gcal",
    name: "Google Calendar",
    icon: "brandGooglecalendar",
    account: "3 calendars",
    state: "syncing",
    sync: { state: "syncing", last: ago(40) },
  },
  {
    id: "health",
    name: "Apple Health",
    icon: "brandApplehealth",
    account: "Mara's iPhone",
    state: "connected",
    sync: { state: "synced", last: ago(18) },
  },
  {
    id: "commerzbank",
    name: "Commerzbank",
    icon: "brandCommerzbank",
    account: "Giro ••• 4410",
    state: "connected",
    sync: { state: "synced", last: ago(95) },
  },
  {
    id: "n26",
    name: "N26",
    icon: "brandN26",
    account: "Main ••• 7781",
    state: "error",
    sync: { state: "error", last: ago(26 * 60) },
  },
  {
    id: "tado",
    name: "tado°",
    icon: "brandTado",
    account: "Home · 6 rooms",
    state: "connected",
    sync: { state: "synced", last: ago(2) },
  },
  {
    id: "tesla",
    name: "Tesla",
    icon: "brandTesla",
    account: "Model Y",
    state: "connected",
    sync: { state: "synced", last: ago(12) },
  },
];

/** Every service the assistant is connected to, how fresh its data is, and what else it can connect. */
export default function Preview() {
  return (
    <AppShell
      navigation="sidebar"
      brand="Life"
      sidebarGroups={NAV}
      active="connections"
      user={{ name: "Mara Ellis", email: "mara@halo.app" }}
      dock={false}
    >
      <div className="tf-in">
        <PageHeader
          title="Connections"
          subtitle="What your agents can read and act in"
          actions={[
            <Button key="add" icon="plus">
              Connect a service
            </Button>,
          ]}
        />
      </div>
      <Stagger className="tf-col" style={{ gap: 16 }}>
        <div
          className="tf-grid"
          style={
            {
              "--cols": "repeat(3, minmax(0, 1fr))",
              "--cols-sm": "1fr",
              gap: 16,
            } as React.CSSProperties
          }
        >
          <StatTile label="Connected services" value="7" tint="mint" />
          <StatTile label="Need attention" value="1" tint="butter" />
          <StatTile label="Items read by agents today" value="214" tint="sky" />
        </div>
        <Panel title="Connected" subtitle="Freshest data first">
          <ConnectionList items={CONNECTED} now={now} onManage={() => {}} onReconnect={() => {}} />
        </Panel>
        <Panel title="Add more" subtitle="49 services in 10 categories">
          <ConnectorGallery
            connectors={CONNECTORS.filter((c) => c.state !== "connected")}
            categories={CATEGORIES}
            onConnect={() => {}}
            onOpen={() => {}}
          />
        </Panel>
      </Stagger>
    </AppShell>
  );
}
```

## Props

### AppShell

| Prop | Type | Notes |
| --- | --- | --- |
| `active?` | `string` |  |
| `brand?` | `ReactNode` | The product name, or a node (a logo mark with the name; collapsed sidebars show it whole). |
| `brandDot?` | `boolean` | The status dot after the brand (default `true`); turn it off next to a logo of your own. |
| `tag?` | `string` |  |
| `nav?` | `NavItem[]` |  |
| `user?` | `{ name: string; email?: string }` |  |
| `onNavigate?` | `(label: string) => void` |  |
| `topExtra?` | `ReactNode` |  |
| `sheetStyle?` | `CSSProperties` |  |
| `contentKey?` | `string \| number` |  |
| `side?` | `ReactNode` |  |
| `dock?` | `boolean` |  |
| `dockItems?` | `DockProps["items"]` |  |
| `railTop?` | `RailItem[]` |  |
| `railBottom?` | `RailItem[]` |  |
| `fill?` | `boolean` | The shell is the whole page: at least the viewport's height (100dvh), no outer radius, the sheet fills the rest; on desktop the sidebar stays in view while the page scrolls, on phones the sheet starts right under the sidebar's bar. |
| `navigation?` | `"top" \| "sidebar"` |  |
| `sidebarGroups?` | `SidebarGroup[]` | With `navigation="sidebar"`: groups instead of the flat `nav` list. |
| `sidebar?` | `Partial<Omit<SidebarProps, "variant" \| "groups">>` | With `navigation="sidebar"`: more sidebar props (collapsed, storageKey, shortcut, linkAs …). |
| `workspaces?` | `WorkspaceSwitcherProps` | With `navigation="sidebar"`: the workspace switcher at the top instead of the brand. |
| `userMenu?` | `(MenuItem \| "-")[]` | The account menu's entries (with `navigation="sidebar"` at the foot of the sidebar). |
| `topbar?` | `boolean \| ReactNode` | With `navigation="sidebar"`: a bar across the top of the frame. The brand (or `workspaces`) moves into its start, as wide as the sidebar below it (expanded or collapsed); `topStart` follows it, `topEnd` sits at the end. Frame, bar and sidebar read as one L around the sheet. Content given here goes between `topStart` and `topEnd`. On phones the bar is the sidebar's bar (menu button and brand) with `topEnd` on the right and `topStart` behind an icon button. |
| `topStart?` | `ReactNode` | With `topbar`: right after the brand, e.g. a search field or a command palette trigger. |
| `topEnd?` | `ReactNode` | With `topbar`: at the end of the bar (buttons, menus); `topExtra` goes there too. |
| `topStartCompact?` | `ReactNode` | With `topbar` on phones: what stands in for `topStart` (default: an icon button that opens `topStart` over the bar). |
| `topStartIcon?` | `IconName` | The icon of that button (default `search`). |
| `topStartLabel?` | `string` | The accessible name of that button (default "Search"). |
| `children?` | `ReactNode` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### ConnectionList

| Prop | Type | Notes |
| --- | --- | --- |
| `items` | `ConnectionItem[]` | Required |
| `now?` | `Date \| string \| number` | "Now" for the relative times; pass it so server and client render the same. |
| `onManage?` | `(id: string) => void` |  |
| `onReconnect?` | `(id: string) => void` | Shown instead of "Manage" on connections in the `error` state. |
| `label?` | `string` | Accessible name (default "Connections"). |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### ConnectorGallery

| Prop | Type | Notes |
| --- | --- | --- |
| `connectors` | `Connector[]` | Required |
| `categories?` | `string[]` | Order of the groups; categories not listed follow in the order they appear. |
| `onConnect?` | `(id: string) => void` |  |
| `onOpen?` | `(id: string) => void` | Opens a connected (or failing) connector. |
| `filters?` | `boolean` | A search field and category chips above the grid (default true). |
| `label?` | `string` | Accessible name (default "Connectors"). |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### PageHeader

| Prop | Type | Notes |
| --- | --- | --- |
| `crumbs?` | `(string \| Crumb)[]` | A breadcrumb above the title (see `Breadcrumb`): labels, or items with `href`/`onClick`. |
| `crumbLinkAs?` | `ElementType` | The element crumb links render as, e.g. Next.js `Link`. |
| `title` | `string` | Required |
| `subtitle?` | `string` |  |
| `actions?` | `ReactNode[]` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Panel

| Prop | Type | Notes |
| --- | --- | --- |
| `side?` | `boolean` |  |
| `title?` | `string` |  |
| `subtitle?` | `string` |  |
| `action?` | `ReactNode` |  |
| `children?` | `ReactNode` |  |
| `surface?` | `Surface` | `"glass"`: translucent glass over what is behind (maps, 3D, video, photos); `"solid"` opts out inside a glass `UIProvider`. |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### StatTile

| Prop | Type | Notes |
| --- | --- | --- |
| `value` | `ReactNode` | Required |
| `label` | `string` | Required |
| `tint?` | `Tint \| "surface" \| "placeholder"` |  |
| `delta?` | `string` |  |
| `delay?` | `number` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### SyncStatus

| Prop | Type | Notes |
| --- | --- | --- |
| `state` | `"synced" \| "syncing" \| "error" \| "paused" \| "never"` | Required |
| `last?` | `Date \| string \| number` | The last successful sync. |
| `next?` | `Date \| string \| number` | The next planned sync. |
| `now?` | `Date \| string \| number` | "Now" for the relative times; pass it so server and client render the same. |
| `counts?` | `{ label: string; value: number }[]` | What the last sync brought: `{ label: "emails", value: 1204 }`. |
| `error?` | `ReactNode` | Why the sync failed. |
| `onSync?` | `() => void` |  |
| `compact?` | `boolean` | One line: state and time only. |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### ServiceMark

| Prop | Type | Notes |
| --- | --- | --- |
| `name` | `string` | The service's name: the accessible name, and the monogram when there is no icon or logo. |
| `icon?` | `IconName` | A brand logo (`brandGmail` …) or a line icon. |
| `logo?` | `ReactNode` | Your own logo (an `<img>` or `<svg>`) instead of the icon. |
| `monogram?` | `string` | Letters for the monogram (default: the initials of `name`). |
| `size?` | `"sm" \| "md" \| "lg"` | 24, 36 (default) or 48 px. |
| `tint?` | `Tint \| "plain"` |  |
| `status?` | `ServiceState` | A dot in the corner with the state in words for screen readers. |
| `decorative?` | `boolean` | Hidden from screen readers when the name is written next to it. |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |
