GuidesComponentspatient

PatientCard.BirthDate

A compound component for displaying patient birth date and age information with calendar icon support. Provides flexible date formatting and age calculation for healthcare applications.

  • Stable unknown
  • Release candidate since 1.16.1-rc.3
  • Development since 1.16.1-dev.2111+9796905

A compound component for displaying patient birth date and age information with calendar icon support. Provides flexible date formatting and age calculation for healthcare applications.

Basic Example

import { PatientCard } from "@ovok/native";
import * as React from "react";

const birthDate = "1990-01-01";

const BasicAgeDisplay = () => (
  <PatientCard.BirthDate>
    <PatientCard.BirthDate.Icon />
    <PatientCard.BirthDate.Text birthDate={birthDate} variant="both" />
  </PatientCard.BirthDate>
);

export default BasicAgeDisplay;

Props

Every prop, with its type and description, is listed in the @ovok/native/patient API reference.

Compound Components

Localization

The component uses these translation keys:

{
  "patient-card": {
    "age-years": "{{age}} years old",
    "birth-date-with-age": "{{date}} ({{age}} years old)"
  }
}

Styling

Theme Colors Used

  • theme.colors.onSurfaceVariant - Icon and text color
  • theme.spacing(1) - Gap between icon and text
  • theme.fonts.bodyMedium - Text typography

Date Calculation

  • Uses date-fns for reliable age calculation
  • Handles timezone differences appropriately
  • Supports various date format patterns
  • Provides localized age display with translations

Last updated on

On this page