Documentation

FUI5003: Too many of a component in one region

moderate

A region contains more of a component than the composition policy allows.

Details

diagnostic
{
  "code": "FUI5003",
  "ruleId": "composition/cardinality",
  "category": "Composition",
  "defaultSeverity": "moderate",
  "lifecycle": "experimental",
  "fixAvailable": false,
  "evidenceRequired": true
}

Guidance

Reduce the matched component to the allowed count for that region. The classic case is more than one primary action in a single group — keep a single primary Button in a ButtonGroup and demote the others to a secondary or outline variant.

This rule is region-scoped: the count is per container (such as one ButtonGroup), not across the whole file, so two separate groups that each contain a single primary are fine. Cardinality constraints can also set a minimum (At least N), not only a maximum. Only statically-resolved props are counted as matches: a dynamic variant={kind} is unknown and does not count. A dynamic value cannot push a region above a maximum, but it also cannot satisfy a minimum, so a region whose only candidates are dynamic can still be flagged.

Intentional exception? Use a narrow, reasoned directive from the in-source suppression reference.