# Property List

> A record's fields as a definition list, each value formatted by its type (email and phone as links, money and percent through Intl, dates, tags, people) and edited in place.

Component · CRM · Pro kit · [Live page](https://ui.twentyfirst.media/pro/components/PropertyList/)

A record's fields as a definition list, each value formatted by its `type` (email and phone as
links, money and percent through `Intl`, dates, tags, people) and edited in place.

- With `onChange(id, value)` every field that is not `readOnly` gets an edit button: Enter or
  leaving the field saves, Escape cancels. `select` fields edit with their `options`.
- Empty values show a dash; `hint` adds a short line under the value.

## Example

```tsx
import * as React from "react";
import { Panel, PropertyList } from "@twentyfirstmedia/pro";
import type { PropertyField } from "@twentyfirstmedia/pro";

export default function Preview() {
  const [fields, setFields] = React.useState<PropertyField[]>([
    { id: "email", label: "Email", type: "email", value: "lena@nordhafen.de" },
    { id: "phone", label: "Phone", type: "phone", value: "+49 40 2287 1190" },
    { id: "web", label: "Website", type: "url", value: "https://nordhafen.de" },
    {
      id: "stage",
      label: "Lifecycle",
      type: "select",
      value: "Customer",
      options: ["Lead", "Prospect", "Customer", "Former customer"],
    },
    {
      id: "value",
      label: "Lifetime value",
      type: "money",
      value: 126400,
      readOnly: true,
      hint: "From invoices",
    },
    { id: "renewal", label: "Renewal", type: "date", value: new Date(2027, 2, 1) },
    { id: "owner", label: "Owner", type: "person", value: "Mara Ellis" },
    { id: "tags", label: "Tags", type: "tags", value: ["Decision maker", "Hamburg"] },
    { id: "source", label: "Source", value: null },
  ]);
  return (
    <Panel title="Details" style={{ maxWidth: 480 }}>
      <PropertyList
        fields={fields}
        onChange={(id, v) =>
          setFields((all) =>
            all.map((f) =>
              f.id !== id
                ? f
                : {
                    ...f,
                    value:
                      f.type === "tags"
                        ? v.split(/,\s*/).filter(Boolean)
                        : f.type === "date"
                          ? new Date(v)
                          : f.type === "money"
                            ? Number(v)
                            : v,
                  },
            ),
          )
        }
      />
    </Panel>
  );
}
```

## Props

### PropertyList

| Prop | Type | Notes |
| --- | --- | --- |
| `fields` | `PropertyField[]` | Required |
| `onChange?` | `(id: string, value: string) => void` | Makes every field that is not `readOnly` editable in place. Values arrive as strings (tags comma-separated). |
| `label?` | `string` | Accessible name (default "Details"). |
| `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. |
