GuidesComponentsdiary

DiaryCard

The DiaryCard component is a specialized interactive card designed for displaying health measurement data and diary entries. It extends TouchableOpacity with healthcare-specific styling and automatic visual state management based on data availability.

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

The DiaryCard component is a specialized interactive card designed for displaying health measurement data and diary entries. It extends TouchableOpacity with healthcare-specific styling and automatic visual state management based on data availability.

Basic Example

import { MeasurementTypeKey } from "@ovok/core/next";
import { DiaryCard } from "@ovok/native";
import * as React from "react";

const BasicDiaryCardExample = () => {
  return (
    <DiaryCard hasData={false}>
      <DiaryCard.StartSection
        left={() => (
          <DiaryCard.TaskIcon
            measurementTypeKey={MeasurementTypeKey.bodyWeight}
          />
        )}
      />

      <DiaryCard.Title>Body Weight</DiaryCard.Title>

      <DiaryCard.MeasuredValue value={"70"} unit={"kg"} time="15:34" />
    </DiaryCard>
  );
};

export default BasicDiaryCardExample;

Props

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

Compound Components

DiaryCardProps is exported from @ovok/native for typing wrappers around the card.

Component Behavior

Visual State Management

The card automatically adjusts its appearance based on the hasData prop:

Has Data (hasData = true):

  • Background: theme.colors.surface
  • Full opacity and normal interaction
  • Standard shadow and elevation

No Data (hasData = false):

  • Background: theme.colors.surfaceDisabled
  • Reduced visual prominence
  • Maintains touch interaction for data entry

Theme Integration

  • Background Colors: Uses Material Design 3 surface colors
  • Border: theme.colors.outlineVariant with hairline width
  • Shadow: theme.colors.shadow with consistent elevation
  • Spacing: theme.spacing(4) padding and theme.spacing(2) gap
  • Border Radius: theme.borderRadius(4) for consistent rounding

Styling

Theme Colors Used

  • theme.colors.surface - Default card background
  • theme.colors.surfaceDisabled - Background when no data is available
  • theme.colors.outlineVariant - Border color
  • theme.colors.shadow - Shadow color for elevation

Last updated on

On this page