Skip to content

fix: refactor checkbox component to update to new DS colors and state - BED-8724#2933

Open
nicole-m-martin wants to merge 15 commits into
mainfrom
BED-8724--checkbox-style-updates-doodle
Open

fix: refactor checkbox component to update to new DS colors and state - BED-8724#2933
nicole-m-martin wants to merge 15 commits into
mainfrom
BED-8724--checkbox-style-updates-doodle

Conversation

@nicole-m-martin

@nicole-m-martin nicole-m-martin commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

Updates the Doodle UI Checkbox component to support the latest Figma design states and introduces a new CheckboxWithLabel component.

Checkbox Figma DS

New Figma Styles:
Screenshot 2026-06-24 at 3 06 02 PM

Motivation and Context

The existing Checkbox component did not fully match the latest Figma design system states and tokens. This update aligns Checkbox with the DS spec and provides a consistent, accessible labeled checkbox foundation for future components like MultiSelect.

Resolves BED-8724

Checkbox

  • Updates unchecked, checked, and indeterminate states with current Figma DS tokens.
  • Adds selected hover and active styles while scoping interactive styles with Tailwind enabled: so they do not effect disabled states.
  • Refactored error styling from aria-invalid with enabled:aria-[invalid=true]:* selectors across unchecked, checked, and indeterminate states.
  • Uses native disabled behavior with disabled:* token styles.
  • Refactored sm, md, and lg size variants to Tailwind shorthand.
  • Keeps the optional icon prop for custom indicator icons.
  • Supports light and dark mode tokens.

CheckboxWithLabel

  • Adds a checkbox + label component for labeled checkbox use cases.
  • Auto-generates an id with useId when one is not provided, ensuring the label is always associated with the checkbox.
  • Lifts the focus ring to the wrapper with :has(:focus-visible) so it surrounds both checkbox and label.
  • Adds an error prop that applies label error styling and forwards aria-invalid to the checkbox.
  • Supports labelClassName and fieldClassName for targeted overrides.

How Has This Been Tested?

Tests

  • Adds new test suite for Checkbox and CheckboxWithLabel: Checkbox.test.tsx

Manual QA

Checked existing Doodle Checkbox usages across the app:

  • Storybook Checkbox states: default, labeled, icon-only, disabled, error, and indeterminate.
  • Explore Cypher editor: Auto-run selected query.
  • Explore Path Edge Filtering dialog: parent indeterminate checkbox and edge type checkboxes.
  • Create User form: Force Password Reset checkbox.
  • Environment selector: Select All Environments and individual environment checkboxes.
  • Saved query permissions: Set to Public checkbox column.
  • Manage Columns panel: checkbox-style column visibility rows.

Storybook

  • Adds stories for default, labeled, icon-only, disabled, and error states.
  • Adds labeled examples for unchecked, checked, indeterminate, error, and disabled states.

Screenshots (optional):

Screen.Recording.2026-06-26.at.2.47.31.PM.mov

Types of changes

  • Chore (a change that does not modify the application functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Database Migrations

Checklist:

Summary by CodeRabbit

Summary

  • New Features

    • Added CheckboxWithLabel for accessible checkbox + label pairing.
    • Expanded Checkbox Storybook coverage with more variants (default, labeled, icon-only, disabled, and error) and a controllable disabled control.
  • Bug Fixes

    • Improved checkbox state visuals (including indeterminate) and error behavior via aria-invalid.
    • Ensured disabled checkbox and label interactions don’t trigger change events.
  • Tests

    • Added coverage for indeterminate rendering, label toggling, disabled interactions, and error/aria-invalid.
  • Style

    • Updated label disabled styling and refined disabled theme tokens (light/dark) for consistent visuals.

@nicole-m-martin nicole-m-martin self-assigned this Jun 26, 2026
@nicole-m-martin nicole-m-martin added the user interface A pull request containing changes affecting the UI code. label Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR updates checkbox styling and behavior, adds a labeled checkbox wrapper, refreshes Storybook examples, expands test coverage, and enables matching Tailwind tokens for disabled input states.

Changes

Checkbox UI and token support

Layer / File(s) Summary
Theme tokens
packages/javascript/doodle-ui/src/tailwind/plugin.ts, packages/javascript/doodle-ui/src/tailwind/preset.ts
Light and dark CSS variables now define disabled input and icon values, and the Tailwind preset exposes the matching color tokens.
Checkbox visuals
packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.tsx
Checkbox styling uses updated variant classes, and the default indicator now renders check and minus icons by state.
CheckboxWithLabel wrapper
packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.tsx, packages/javascript/doodle-ui/src/components/Label/Label.tsx, packages/javascript/doodle-ui/src/components/Checkbox/index.ts
CheckboxWithLabel renders a labeled checkbox with generated ids, forwarded validation state, disabled label styling, and public re-exports.
Stories and tests
packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.stories.tsx, packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.test.tsx
Storybook stories and RTL tests cover labeled, icon-only, disabled, error, indeterminate, and click behavior cases.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: TheNando

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main checkbox refactor and design-system update, and includes the associated ticket.
Description check ✅ Passed The description matches the template well with description, motivation, testing, screenshots, types of changes, and checklist items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch BED-8724--checkbox-style-updates-doodle

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nicole-m-martin nicole-m-martin changed the title Bed 8724 checkbox style updates doodle fix: refactor checkbox component to update to new DS colors and state - BED-8724 Jun 26, 2026
@coderabbitai coderabbitai Bot added enhancement New feature or request javascript Pull requests that update javascript code labels Jun 26, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.stories.tsx`:
- Around line 46-47: The standalone Checkbox stories currently render unlabeled
inputs, so add accessible names to the Default, Disabled, and Error stories in
Checkbox.stories.tsx. Follow the pattern already used by CheckboxWithoutLabel by
passing an aria-label through the story args or render function for each of
those story exports, and keep the change localized to the story definitions for
Default, Disabled, and Error.

In `@packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.tsx`:
- Around line 61-64: Restore the public TypeScript surface by exporting
CheckboxProps again from Checkbox.tsx; the issue is that the props type was made
local during the refactor, breaking downstream type imports even though Checkbox
and CheckboxVariants runtime behavior stayed the same. Update the type
declaration near CheckboxProps so it remains exported, and keep the existing
shape based on React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
plus size and icon.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: a3cd0e82-a8e3-4489-9e77-61c54d29c857

📥 Commits

Reviewing files that changed from the base of the PR and between 4376514 and 5d1d155.

📒 Files selected for processing (7)
  • packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.stories.tsx
  • packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.test.tsx
  • packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.tsx
  • packages/javascript/doodle-ui/src/components/Checkbox/index.ts
  • packages/javascript/doodle-ui/src/components/Label/Label.tsx
  • packages/javascript/doodle-ui/src/tailwind/plugin.ts
  • packages/javascript/doodle-ui/src/tailwind/preset.ts

Comment thread packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.stories.tsx Outdated
Comment thread packages/javascript/doodle-ui/src/components/Checkbox/Checkbox.tsx Outdated
@coderabbitai coderabbitai Bot removed the enhancement New feature or request label Jun 26, 2026

@cweidenkeller cweidenkeller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@coderabbitai coderabbitai Bot added bug Something isn't working and removed javascript Pull requests that update javascript code labels Jul 2, 2026
@nicole-m-martin nicole-m-martin added javascript Pull requests that update javascript code and removed bug Something isn't working labels Jul 2, 2026
@coderabbitai coderabbitai Bot added the enhancement New feature or request label Jul 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/javascript/doodle-ui/src/tailwind/plugin.ts (1)

234-235: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the redundant --secondary CSS variable in the dark theme. secondary already maps to --secondary-main, and --secondary isn’t referenced elsewhere in this package; keeping both adds dead, asymmetric state. packages/javascript/doodle-ui/src/tailwind/plugin.ts:234-235

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/javascript/doodle-ui/src/tailwind/plugin.ts` around lines 234 - 235,
The dark theme in plugin.ts defines a redundant `--secondary` CSS variable
alongside `--secondary-main`, but `secondary` already maps through
`--secondary-main` and the extra variable is unused. Remove the `--secondary`
entry from the dark theme variable map in the Tailwind plugin while keeping
`--secondary-main` as the single source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/javascript/doodle-ui/src/tailwind/plugin.ts`:
- Around line 234-235: The dark theme in plugin.ts defines a redundant
`--secondary` CSS variable alongside `--secondary-main`, but `secondary` already
maps through `--secondary-main` and the extra variable is unused. Remove the
`--secondary` entry from the dark theme variable map in the Tailwind plugin
while keeping `--secondary-main` as the single source of truth.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 08b85c58-71cd-49a4-bfab-97a0efd1343e

📥 Commits

Reviewing files that changed from the base of the PR and between 7f730cf and 0f3a96e.

📒 Files selected for processing (2)
  • packages/javascript/doodle-ui/src/tailwind/plugin.ts
  • packages/javascript/doodle-ui/src/tailwind/preset.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/javascript/doodle-ui/src/tailwind/preset.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request javascript Pull requests that update javascript code user interface A pull request containing changes affecting the UI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants