Skip to content

Problem list

A patient's conditions as a record keeps them: the active ones first, the past ones below, each with its coded term and when it began and ended.

Fictional patient, not real data
ProblemDates
Active · 4
Essential hypertensionSNOMED CT 59621000Since Nov 17, 2009
Type 2 diabetes mellitusSNOMED CT 44054006Since Mar 6, 2012
Chronic kidney disease stage 3ASNOMED CT 700378005Since Jun 2, 2023
Osteoarthritis of kneeSNOMED CT 239873007Since 2018
Past · 2
Community acquired pneumoniaSNOMED CT 385093006Jan 8, 2024 – Feb 1, 2024
Depressive disorderSNOMED CT 35489007Jan 12, 2015 – Jun 30, 2016

Installation

In a project set up as in Installation, run:

bunx shadcn@4.22.1 add https://organui.com/r/problem-list.json

Or by name: bunx shadcn@4.22.1 add @organui/problem-list.

The source installs into your UI components directory, along with shadcn's table if you do not have it yet. It holds no state, so it renders in server and client components alike.

View registry item JSON

Usage

import { ProblemList, type Problem } from "@/components/ui/problem-list"

const problems: Problem[] = [
  {
    id: "diabetes",
    name: "Type 2 diabetes mellitus",
    code: { system: "SNOMED CT", value: "44054006" },
    significance: "major",
    onset: "2012-03-06",
  },
  {
    id: "pneumonia",
    name: "Community acquired pneumonia",
    status: "resolved",
    onset: "2024-01-08",
    resolved: "2024-02-01",
  },
]

export function Problems() {
  return <ProblemList problems={problems} caption="Problems" />
}

Active and past

Problems group under Active and Past, each group a labelled set of rows, with its count. A resolved or inactive problem goes under Past, muted. Within each group, major problems lead and are bold, as general practice records mark the conditions that shape care; groupProblems gives the same order for a view of your own.

A code shows under the name with its system, such as SNOMED CT 44054006, so the term can be traced to the record. Set showCodes={false} for a summary.

Dates

An active problem shows when it began, and a past one when it began and ended. Full ISO 8601 dates show as UTC dates in US English; pass formatDate for your own. Records often hold less than a date, such as a year or "Childhood", so any other text reads as written rather than as a guessed day.

A display component: it does not choose, code or reconcile problems. The examples are fictional.

Examples

Without Codes

Hide the coded terms for a summary view.

ProblemDates
Active · 4
Essential hypertensionSince Nov 17, 2009
Type 2 diabetes mellitusSince Mar 6, 2012
Chronic kidney disease stage 3ASince Jun 2, 2023
Osteoarthritis of kneeSince 2018
Past · 2
Community acquired pneumoniaJan 8, 2024 – Feb 1, 2024
Depressive disorderJan 12, 2015 – Jun 30, 2016

Dates as Recorded

Onsets such as "Childhood" or a year read as written; only full dates are formatted.

ProblemDates
Active · 2
AsthmaSince Childhood
MigraineSince 2015
Past · 1
Acute appendicitis1998 – 1998

API Reference

Import ProblemListProps from the same file as ProblemList.

ProblemList props
PropTypeDefault
problemsreadonly Problem[]

The problems, active and past, in any order.

Required
captionReact.ReactNode

Names the table for assistive technology and shows below it.

—
showCodesboolean

Shows each problem's code beneath its name. Defaults to true.

true
formatDate(date: string) => string

Formats full ISO dates. Defaults to a UTC date such as "Oct 1, 2026".

defaultFormatDate

Any other prop, such as className, id or aria-*, is passed to the root <div>.