# CategoryBars

Horizontal labeled bars for a ranked breakdown of a handful of named categories with their counts visible, the read-the-numbers chart in the family.

Version: 0.2.0-preview.1 (preview)
Content digest: 70ac710f4d22dce040e7ac593379ba8aca9dcb59a0b9c0f839819cae0e2bb721
Contract kind: source-derived
Source: packages/design-system/src/components/visualizations/CategoryBars/CategoryBars.tsx

## Guidance

{
  "summary": "Horizontal labeled bars for a ranked breakdown of a handful of named categories with their counts visible, the read-the-numbers chart in the family.",
  "guidance": [
    {
      "heading": "Overview",
      "body": "Horizontal labeled bars — a ranked breakdown of a handful of named categories with their counts\nvisible."
    },
    {
      "heading": "When to use",
      "body": "This is the \"read the actual numbers\" chart: reach for it when the reader must compare the\nmagnitudes of a small set of named categories and see the exact counts. Each row takes its\n`color`; omit `color` and rows cycle the default category palette.\n\nPrefer it over `ActionOrbs` (a looser proportional 2-4 category summary) and\n`BubbleMatrix`/`BurstGraph` (decorative) whenever precision matters. Use `BarChart` instead when\nthe x-axis is time rather than categories.\n\nNot currently used in the app."
    }
  ],
  "usage": [],
  "examples": [],
  "source": "packages/design-system/src/components/visualizations/CategoryBars/CategoryBars.mdx",
  "status": "local-preview",
  "note": "Guidance is read from local documentation, originally imported from the frozen source. Platform assertions in guidance are not parity verification."
}

## Contract and public API

```json
{
  "props": [
    {
      "name": "items",
      "type": "readonly CategoryDatum[]",
      "declared_type": "readonly CategoryDatum[]",
      "required": true,
      "description": "Category rows rendered in order.",
      "source": {
        "path": "packages/design-system/src/components/visualizations/types.ts",
        "line": 61
      }
    },
    {
      "name": "ariaLabel",
      "type": "string | undefined",
      "declared_type": "string",
      "required": false,
      "description": "Accessible label for meaningful chart content.",
      "source": {
        "path": "packages/design-system/src/components/visualizations/types.ts",
        "line": 63
      }
    },
    {
      "name": "testId",
      "type": "string | undefined",
      "declared_type": "string",
      "required": false,
      "description": "Optional test selector.",
      "source": {
        "path": "packages/design-system/src/components/visualizations/types.ts",
        "line": 65
      }
    }
  ],
  "prop_shapes": {},
  "api": {
    "method": "typescript-type-checker",
    "typescript_version": "5.9.3",
    "public_export": "CategoryBars",
    "public_path": "CategoryBars",
    "import_path": "@cloakedinc/design-system",
    "root_kind": "component",
    "entrypoints": [
      {
        "name": "CategoryBars",
        "signature": 1,
        "visibility": "public",
        "source": {
          "path": "packages/design-system/src/components/visualizations/CategoryBars/CategoryBars.tsx",
          "line": 12
        },
        "props_type": "CategoryBarsProps",
        "props": [
          {
            "name": "items",
            "type": "readonly CategoryDatum[]",
            "declared_type": "readonly CategoryDatum[]",
            "required": true,
            "description": "Category rows rendered in order.",
            "source": {
              "path": "packages/design-system/src/components/visualizations/types.ts",
              "line": 61
            }
          },
          {
            "name": "ariaLabel",
            "type": "string | undefined",
            "declared_type": "string",
            "required": false,
            "description": "Accessible label for meaningful chart content.",
            "source": {
              "path": "packages/design-system/src/components/visualizations/types.ts",
              "line": 63
            }
          },
          {
            "name": "testId",
            "type": "string | undefined",
            "declared_type": "string",
            "required": false,
            "description": "Optional test selector.",
            "source": {
              "path": "packages/design-system/src/components/visualizations/types.ts",
              "line": 65
            }
          }
        ],
        "branches": [],
        "constraints": [],
        "extraction_status": "extracted"
      }
    ],
    "type_sources": [
      {
        "path": "packages/design-system/src/components/visualizations/types.ts",
        "line": 46,
        "name": "CategoryDatum",
        "code": "export interface CategoryDatum {\n    /** Stable category identifier. */\n    id: string;\n    label: React.ReactNode;\n    /** Non-negative category count or magnitude. */\n    value: number;\n    color?: string;\n}"
      },
      {
        "path": "packages/design-system/src/components/visualizations/types.ts",
        "line": 59,
        "name": "CategoryBarsProps",
        "code": "export interface CategoryBarsProps {\n    /** Category rows rendered in order. */\n    items: readonly CategoryDatum[];\n    /** Accessible label for meaningful chart content. */\n    ariaLabel?: string;\n    /** Optional test selector. */\n    testId?: string;\n}"
      }
    ],
    "defaults_policy": "Only explicit destructured parameter initializers are extracted. Other runtime defaults remain in implementation source."
  },
  "spec": {
    "$schema": "../../../specs/component-spec.schema.json",
    "identity": {
      "name": "CategoryBars",
      "status": "preview",
      "version": "1.0.0",
      "summary": "Horizontal labeled bars for a ranked breakdown of a handful of named categories with their counts visible, the read-the-numbers chart in the family."
    },
    "parts": [
      {
        "id": "list",
        "label": "List",
        "description": "The column of category rows.",
        "required": true
      },
      {
        "id": "row",
        "label": "Row",
        "description": "A label, track, and value aligned in a three-column grid."
      },
      {
        "id": "track",
        "label": "Track",
        "description": "The rail whose fill length scales to the category value."
      },
      {
        "id": "value",
        "label": "Value",
        "description": "The right-aligned numeric count for the row."
      }
    ],
    "allowedDesignChoices": {
      "variants": {
        "base": {
          "label": "Base",
          "description": "Category data changes the reading without changing the row treatment."
        }
      },
      "sizes": {}
    },
    "variants": [
      {
        "id": "base",
        "label": "Base",
        "description": "A column of labeled category rows with proportional bars and counts.",
        "platforms": [
          "ios",
          "android",
          "web"
        ]
      }
    ],
    "sizes": [],
    "measurements": [
      {
        "id": "track-height",
        "label": "Track height",
        "kind": "exact",
        "token": "--cds-size-4",
        "value": 4,
        "unit": "px",
        "appliesTo": [
          "track"
        ]
      },
      {
        "id": "row-gap",
        "label": "Row gap",
        "kind": "exact",
        "token": "--cds-space-12",
        "value": 12,
        "unit": "px",
        "appliesTo": [
          "list"
        ]
      },
      {
        "id": "column-gap",
        "label": "Row column gap",
        "kind": "exact",
        "token": "--cds-space-8",
        "value": 8,
        "unit": "px",
        "appliesTo": [
          "row"
        ]
      }
    ],
    "layout": {
      "alignment": "Each row is a label, a stretching track, and a right-aligned value in a three-column grid.",
      "flow": "Rows stack top to bottom in a column.",
      "notes": [
        "The track column stretches while the label and value columns size to content."
      ]
    },
    "typographyAndColor": {
      "typography": [
        {
          "label": "Row label and value",
          "description": "The category label and count use the body ramp.",
          "token": "--cds-type-body-size"
        }
      ],
      "colors": [
        {
          "label": "Row label and value",
          "description": "Label and count use primary text.",
          "token": "--cds-text-primary"
        },
        {
          "label": "Track",
          "description": "The unfilled rail behind each bar.",
          "token": "--cds-bg-page"
        }
      ]
    },
    "states": [
      {
        "id": "ranked",
        "label": "Ranked",
        "description": "Rows render in order with bars scaled to the largest value."
      },
      {
        "id": "default-palette",
        "label": "Default palette",
        "description": "Rows without a color cycle the built-in category palette."
      },
      {
        "id": "empty",
        "label": "Empty",
        "description": "No rows renders nothing, so pair with an upstream empty state."
      }
    ],
    "behavior": [
      {
        "label": "Scaled to max",
        "description": "Bar length scales to the largest category value in the set."
      },
      {
        "label": "Palette fallback",
        "description": "Rows take their own color, or cycle the default category palette when none is given."
      },
      {
        "label": "Readable counts",
        "description": "Each row shows its formatted numeric count beside the bar."
      }
    ],
    "accessibility": [
      {
        "label": "Meaningful chart",
        "description": "Pass an accessible label so the row set is announced as a meaningful image."
      },
      {
        "label": "Track is presentational",
        "description": "The bar track is hidden from assistive technology since the label and count carry the meaning."
      }
    ],
    "contentAdaptation": [
      {
        "label": "Read the numbers",
        "description": "Use CategoryBars when the reader must compare category magnitudes with the actual counts visible."
      },
      {
        "label": "Categories over time",
        "description": "Use BarChart instead when the x-axis is time rather than named categories."
      }
    ],
    "motionHaptics": {
      "motion": [
        {
          "label": "No intrinsic motion",
          "description": "The rows do not animate on mount; a parent may transition the whole chart."
        }
      ],
      "haptics": [
        {
          "label": "No feedback",
          "description": "The chart is a display and requests no haptic feedback."
        }
      ]
    },
    "platformDifferences": []
  },
  "platforms": {
    "implemented": [
      "web"
    ],
    "native": "Imported design guidance only; no native implementation or parity verification in this preview.",
    "react": {
      "implementation": "local",
      "status": "preview",
      "parity": "web-reference"
    },
    "vue": {
      "implementation": "absent",
      "parity": "not-verified",
      "status": "reference-only"
    },
    "swift": {
      "implementation": "absent",
      "parity": "not-verified",
      "status": "reference-only"
    },
    "kotlin": {
      "implementation": "absent",
      "parity": "not-verified",
      "status": "reference-only"
    }
  },
  "tokens": [
    {
      "name": "--cds-size-4",
      "light": "4px",
      "dark": "4px"
    },
    {
      "name": "--cds-space-12",
      "light": "12px",
      "dark": "12px"
    },
    {
      "name": "--cds-space-8",
      "light": "8px",
      "dark": "8px"
    },
    {
      "name": "--cds-type-body-size",
      "light": "1rem",
      "dark": "1rem"
    },
    {
      "name": "--cds-text-primary",
      "light": "#141410",
      "dark": "#f3f1ed"
    },
    {
      "name": "--cds-bg-page",
      "light": "#f3f1ed",
      "dark": "#141410"
    }
  ],
  "review": {
    "local_status": "not-reviewed",
    "source_approval": null,
    "imported_spec_status": "approved",
    "spec_origin": "imported-adapted",
    "local_spec_source_status": "approved",
    "imported_source_revision": "f96f416e1c3bfbfaffcd155a88b87b18b8bb25f1",
    "note": "Inherited specification status is provenance, not approval of the current local implementation or extracted contract."
  },
  "missing_facts": [
    {
      "code": "human-review-pending",
      "detail": "This local preview has no recorded human design or engineering sign-off."
    },
    {
      "code": "platform-parity-unverified",
      "detail": "Vue, Swift and Kotlin implementations are absent from this package; platform parity has not been verified."
    },
    {
      "code": "figma-mapping-unverified",
      "detail": "No current component-level Figma node and immutable revision have been verified for this contract."
    }
  ]
}
```

## Visual states

- [Default](/storybook/iframe.html?id=cloaked-design-system-visualizations-categorybars--default&viewMode=story) | export: Default | source: packages/design-system/src/components/visualizations/CategoryBars/CategoryBars.stories.tsx

- [Default Palette](/storybook/iframe.html?id=cloaked-design-system-visualizations-categorybars--default-palette&viewMode=story) | export: DefaultPalette | source: packages/design-system/src/components/visualizations/CategoryBars/CategoryBars.stories.tsx

- [Empty](/storybook/iframe.html?id=cloaked-design-system-visualizations-categorybars--empty&viewMode=story) | export: Empty | source: packages/design-system/src/components/visualizations/CategoryBars/CategoryBars.stories.tsx

- [Dense](/storybook/iframe.html?id=cloaked-design-system-visualizations-categorybars--dense&viewMode=story) | export: Dense | source: packages/design-system/src/components/visualizations/CategoryBars/CategoryBars.stories.tsx

- [Dark Theme](/storybook/iframe.html?id=cloaked-design-system-visualizations-categorybars--dark-theme&viewMode=story) | export: DarkTheme | source: packages/design-system/src/components/visualizations/CategoryBars/CategoryBars.stories.tsx

Preview pending human sign-off. Source-derived APIs and successful checks do not certify accessibility, native parity or approval.
