Skip to content

KeyValue

A list of facts about one thing: the name of each fact on the left and its value on the right.

import { KeyValue, KeyValueSkeleton } from '@sypnia/ui/react'

On this page
  1. Facts about a project
  2. Long machine values
  3. Missing and loading values
  4. Skeleton
  5. When to use it
  6. For everyone
  7. Props

Facts about a project

Text, a badge and a date.

Project
Storefront
Region
Frankfurt
Plan
Team
Created
November 3, 2026
Owner
Laura Méndez
Code
import { Badge, KeyValue } from '@sypnia/ui/react';

// Names on the left, values on the right; on a phone each value goes under its name.
export default function Basic() {
  return (
    <KeyValue items={[
      ['Project', 'Storefront'],
      ['Region', 'Frankfurt'],
      ['Plan', <Badge tone="ok">Team</Badge>],
      ['Created', 'November 3, 2026'],
      ['Owner', 'Laura Méndez'],
    ]} />
  );
}

Long machine values

They wrap inside their column.

Project ID
prj_8f2k1x9c4m7q
Address
https://storefront.sypnia.app
Connection
postgresql://readonly@db.storefront.sypnia.app:5432/storefront?sslmode=require
Code
import { KeyValue } from '@sypnia/ui/react';

// Long values wrap inside their column instead of pushing the page sideways.
export default function MachineValues() {
  return (
    <KeyValue items={[
      ['Project ID', <span className="sy-machine">prj_8f2k1x9c4m7q</span>],
      ['Address', <span className="sy-machine">https://storefront.sypnia.app</span>],
      ['Connection', <span className="sy-machine">postgresql://readonly@db.storefront.sypnia.app:5432/storefront?sslmode=require</span>],
    ]} />
  );
}

Missing and loading values

A dash for what does not exist, a skeleton for what is on its way.

Last backup
Nov 17, 2026, 2:00 AM
Last restore
—
Size
—
Next backup
Code
import { KeyValue, Skeleton, useSypnia } from '@sypnia/ui/react';

// A missing value is a dash, never a blank or the word «null»; a loading one is a skeleton.
export default function EmptyValues() {
  const { format } = useSypnia();
  return (
    <KeyValue items={[
      ['Last backup', format.dateTime('2026-11-17T02:00:00')],
      ['Last restore', format.dateTime(null)],
      ['Size', format.bytes(undefined)],
      ['Next backup', <Skeleton width="9rem" />],
    ]} />
  );
}

Skeleton

The real piece and its skeleton: the same box, so nothing moves when the data arrives.

Region
us-east-1
Plan
Team
Created
March 2, 2024
Region
Plan
Created
Code
import type { CSSProperties } from 'react';
import { KeyValue, KeyValueSkeleton } from '@sypnia/ui/react';

// With «loading» the names stay; KeyValueSkeleton when not even they are known. The skeleton has the same box as the real one, so nothing moves when the data arrives.
export default function Skeleton() {
  return (
    <div className="sy-grid" style={{ '--min': '16rem' } as CSSProperties}>
      <KeyValue items={[['Region', 'us-east-1'], ['Plan', 'Team'], ['Created', 'March 2, 2024']]} />
      <KeyValue items={[['Region', ''], ['Plan', ''], ['Created', '']]} loading />
      <KeyValueSkeleton rows={3} />
    </div>
  );
}

When to use it

Use it when

  • Details of one thing: a project, an order, a member.
  • Values of different kinds: text, dates, badges, IDs.

Do not use it when

  • Several things share the same facts: that is a Table.
  • The person can change the values: that is a form with Fields.
  • A value must be copied often: use a CopyField for it.

For everyone

  • It is a description list (dl): screen readers pair each name with its value.
  • On phones each value goes under its name. Long values wrap; nothing scrolls sideways.
  • Empty values show a dash, written by the formatters, never a blank or «null».

Props

KeyValueTypeDefault
itemsrequired [ReactNode, ReactNode][]
loading boolean
KeyValueSkeletonTypeDefault
rows number 4
  1. Facts about a project
  2. Long machine values
  3. Missing and loading values
  4. Skeleton
  5. When to use it
  6. For everyone
  7. Props

    Search pages, sections and terms