Skip to content

feat(table): add onCheckedChange to Table.CheckCell and Table.CheckHead#437

Merged
mattrothenberg merged 1 commit intomainfrom
feat/table-on-checked-change
Apr 22, 2026
Merged

feat(table): add onCheckedChange to Table.CheckCell and Table.CheckHead#437
mattrothenberg merged 1 commit intomainfrom
feat/table-on-checked-change

Conversation

@mattrothenberg
Copy link
Copy Markdown
Collaborator

Summary

Align `Table.CheckCell` and `Table.CheckHead` with the `Checkbox` component's signature by adding an `onCheckedChange` prop that takes an optional second argument exposing event details. The existing `onValueChange` prop is retained as a deprecated alias — this is a backwards-compatible, additive change (minor bump).

Context

The v2 Checkbox breaking change removed `onValueChange` in favor of `onCheckedChange` (with optional event details). Table's `Table.CheckCell` / `Table.CheckHead` happened to use the same name (`onValueChange`) for their own consumer-facing prop — it's a Table prop, not a Checkbox passthrough, so v2 doesn't break Table consumers. But the naming collision would be confusing going forward: the Table prop would share a name with a prop Checkbox explicitly deleted.

Change

  • New prop: `onCheckedChange: (checked: boolean, eventDetails?: CheckboxChangeEventDetails) => void` on `Table.CheckCell` and `Table.CheckHead`.
  • Deprecated alias: `onValueChange` retained with `@deprecated` JSDoc. Picked up automatically by the `no-deprecated-props` lint rule via component registry codegen.
  • Internal wiring: Both handlers fire when set, so code passing either prop (or both, during migration) works identically.
  • Docs: updated usage examples, added migration snippet on the `/components/table` page.
  • Demos: existing `TableDemo.tsx` demos migrated to the new name as an example for readers.
  • Tests: new `table.test.tsx` locks in three invariants — new prop works with event details, deprecated prop still fires, both can coexist.

Migration (optional)

// Before (still works, but now emits a lint warning)
<Table.CheckCell onValueChange={(checked) => toggleRow(id)} />

// After
<Table.CheckCell onCheckedChange={(checked) => toggleRow(id)} />

// With event details
<Table.CheckCell
  onCheckedChange={(checked, eventDetails) => {
    toggleRow(id);
    eventDetails?.event.stopPropagation();
  }}
/>

Why additive instead of breaking

Considered as part of the v2 major (synchronize with Checkbox) but landed as additive because:

  • Every prior removed-prop transition in Kumo (`Checkbox.onChange`, `Select.hideLabel`, `Banner.text`, `DropdownMenu.Item.href`, …) went through a deprecation cycle first. Consistency with project convention.
  • v2's narrative is "Checkbox signature change"; bundling a separate Table rename would muddy the changelog and force consumer migrations they didn't sign up for.
  • Alias cost is ~5 lines and the lint rule nudges migration for free.

Verification

  • `pnpm --filter @cloudflare/kumo test -- --run table` → 3/3 new tests pass.
  • `pnpm --filter @cloudflare/kumo tsc --noEmit` → no Table-related type errors.

Checklist

  • Reviews
  • bonk has reviewed the change
  • automated review not possible because: waiting on bonk
  • Tests
  • Tests included/updated
  • Automated tests not possible - manual testing has been completed as follows:
  • Additional testing not necessary because:

Align Table.CheckCell and Table.CheckHead with the Checkbox component's
signature by adding an `onCheckedChange` prop that takes an optional
second argument exposing event details from the underlying Checkbox.

The existing `onValueChange` prop is retained as a deprecated alias —
it still works and continues to be called, so no consumer code needs to
change immediately. The `no-deprecated-props` lint rule now flags
`onValueChange` usage on these components, pointing migrators to the
new name.

This is a backwards-compatible change and ships as a minor bump. The
deprecated alias will be removed in a future major version.
@mattrothenberg
Copy link
Copy Markdown
Collaborator Author

/bonk what say you?

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 22, 2026

npm i https://pkg.pr.new/@cloudflare/kumo@437

commit: d9ab23c

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: LGTM ✅

This is a well-structured, backwards-compatible change that aligns Table.CheckCell and Table.CheckHead with the Checkbox component's signature.

What I verified:

  1. Implementation (table.tsx):

    • New onCheckedChange prop correctly accepts (checked: boolean, eventDetails?: CheckboxChangeEventDetails) => void
    • Deprecated onValueChange retained with @deprecated JSDoc for lint rule integration
    • Both handlers fire when set, enabling smooth migration
    • Event details properly passed through from underlying Checkbox
  2. Tests (table.test.tsx) - All 3 pass:

    • ✅ New onCheckedChange prop works with event details
    • ✅ Deprecated onValueChange still fires for backward compatibility
    • ✅ Both props can coexist during migration
  3. Documentation (table.mdx):

    • Clear migration examples showing before/after
    • Event details usage documented
    • Deprecation notice appropriately placed
  4. Demos (TableDemo.tsx):

    • All checkbox demos migrated to new onCheckedChange prop
    • Consistent pattern across TableWithCheckboxDemo, TableSelectedRowDemo, and TableFullDemo
  5. Changeset:

    • Correctly marked as minor bump for additive change
    • Clear explanation of migration path

Code quality notes:

  • Clean implementation with proper TypeScript types
  • Follows the project's deprecation pattern (matches Checkbox, Select, Banner migrations)
  • displayName already set correctly for both components
  • Uses semantic token styling conventions appropriately

The unrelated test failures (missing component-registry.json) are pre-existing and not caused by this PR.

Approved for merge.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 22, 2026

I've completed my review of PR #437 and posted an approving review.

Summary

The PR adds onCheckedChange to Table.CheckCell and Table.CheckHead as a new prop, while keeping onValueChange as a deprecated alias for backward compatibility. This aligns the Table checkbox components with the Checkbox component's signature.

Key points verified:

  • ✅ All 3 new table tests pass
  • ✅ Implementation correctly passes event details through from the underlying Checkbox
  • ✅ Backward compatibility maintained - both old and new props work
  • ✅ Documentation updated with migration examples
  • ✅ Demo code migrated to use the new prop
  • ✅ Changeset correctly marks this as a minor (additive) change

The implementation follows Kumo's established deprecation patterns and the code is clean and well-tested. The unrelated test failures in the CI output are pre-existing issues with missing component-registry.json (auto-generated at build time), not caused by this PR.

github run

@github-actions
Copy link
Copy Markdown
Contributor

Docs Preview

View docs preview

Commit: 6a50f76

@github-actions
Copy link
Copy Markdown
Contributor

Visual Regression Report — 14 changed, 23 unchanged

14 screenshot(s) with visual changes:

Button / Variant: Secondary

161 px (0.16%) changed

Before After Diff
Before After Diff

Button / Loading State

1,310 px (1.29%) changed

Before After Diff
Before After Diff

Dialog / Dialog With Actions

191 px (0.19%) changed

Before After Diff
Before After Diff

Dialog / Dialog Alert

354 px (0.35%) changed

Before After Diff
Before After Diff

Dialog / Dialog Confirmation

821 px (0.81%) changed

Before After Diff
Before After Diff

Dialog (Open)

0 px (0%) changed

Before After Diff
Before After Diff

Select / Select Basic

300 px (0.3%) changed

Before After Diff
Before After Diff

Select / Select Sizes

855 px (0.46%) changed

Before After Diff
Before After Diff

Select / Select Without Label

161 px (0.16%) changed

Before After Diff
Before After Diff

Select / Select Loading

0 px (0%) changed

Before After Diff
Before After Diff

Select / Select Grouped

194 px (0.19%) changed

Before After Diff
Before After Diff

Select / Select Grouped With Disabled

450 px (0.44%) changed

Before After Diff
Before After Diff

Select / Select Long List

1,428 px (1.21%) changed

Before After Diff
Before After Diff

Select (Open)

1,942 px (0.01%) changed

Before After Diff
Before After Diff
23 screenshot(s) unchanged
  • Button / Basic
  • Button / Variant: Primary
  • Button / Variant: Ghost
  • Button / Variant: Destructive
  • Button / Variant: Outline
  • Button / Variant: Secondary Destructive
  • Button / Sizes
  • Button / With Icon
  • Button / Icon Only
  • Button / Disabled State
  • Button / Title
  • Dialog / Dialog Basic
  • Dialog / Dialog With Select
  • Dialog / Dialog With Combobox
  • Dialog / Dialog With Dropdown
  • Select / Select With Field
  • Select / Select Placeholder
  • Select / Select With Tooltip
  • Select / Select Custom Rendering
  • Select / Select Multiple
  • Select / Select Complex
  • Select / Select Disabled Options
  • Select / Select Disabled Items

Generated by Kumo Visual Regression

@mattrothenberg mattrothenberg merged commit 07426f6 into main Apr 22, 2026
17 checks passed
@mattrothenberg mattrothenberg deleted the feat/table-on-checked-change branch April 22, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants