Skip to content

Table: Add indeterminate checkbox state support for select-all header #12404

@rhamilto

Description

@rhamilto

What is the issue?

PatternFly's Table (and DataView Table) components do not support indeterminate checkbox state for the select-all header checkbox, despite this being recommended in the PatternFly bulk selection design guidelines.

Expected behavior:
The select-all checkbox in the table header should support three states:

  • Unchecked - no items selected

  • Indeterminate (dash/minus icon) - some items selected

  • Checked - all items selected

Current behavior:
The ThSelectType interface only supports isSelected: boolean, which means the checkbox can only be checked or unchecked. When some (but not all) items are selected, the checkbox appears unchecked, which doesn't properly reflect the selection state to users.

Steps to reproduce

  1. Create a table with selectable rows using the select prop on Th
  2. Select some (but not all) rows
  3. Observe that the header checkbox remains unchecked, even though some items are selected

Code example

// Current interface (v6.4.2)
export interface ThSelectType {
    onSelect?: OnSelect;
    isSelected: boolean;  // Only supports true/false, no indeterminate
    isHeaderSelectDisabled?: boolean;
    isDisabled?: boolean;
    props?: any;
}

Proposed solution

Add support for indeterminate state to ThSelectType:

export interface ThSelectType {
    onSelect?: OnSelect;
    isSelected: boolean;
    isIndeterminate?: boolean;  // NEW: Support for partial selection state
    isHeaderSelectDisabled?: boolean;
    isDisabled?: boolean;
    props?: any;
}

The implementation would need to:

  1. Update the ThSelectType interface to include isIndeterminate?: boolean
  2. Update the selectable decorator to pass indeterminate state to the checkbox
  3. Update SelectColumn to set the checkbox's indeterminate property via ref

Related issues

Why this is still needed

While BulkSelect in the toolbar is the recommended pattern, there are valid use cases for table-only selection:

  1. Tables without toolbars
  2. Compact UIs where toolbar space is limited
  3. Consistency with PatternFly design guidelines that show indeterminate state for table headers

Product and version

  • @patternfly/react-table: 6.4.2

  • User project: OpenShift Console (using PatternFly DataView)

Type

Enhancement


Jira Issue: PF-4099

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions