fix(CheckboxGroup): add label and description to theme slots#6351
fix(CheckboxGroup): add label and description to theme slots#6351
Conversation
Per nuxt#6337, the `CheckboxGroup` theme only declares `root`, `fieldset`, `legend` and `item` slots, even though the `CheckboxGroupSlots` type defines `label` and `description` slots that get forwarded to each inner `Checkbox`. As a result, declaring ```ts ui: { checkboxGroup: { slots: { label: 'font-normal' } } } ``` in `app.config.ts` raises a TypeScript error because `label` is not a known key of the slots object. Add `label` and `description` to the slots object, matching the existing `RadioGroup` theme pattern. This makes both keys typeable in `app.config.ts` and gives them sensible defaults consistent with RadioGroup. Closes nuxt#6337
📝 WalkthroughWalkthroughThe change extends the Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/theme/checkbox-group.ts (1)
9-10: Please add a regression test for typedapp.config.tsslot overrides.Given this is a typing-surface fix, add/update a test that asserts
ui.checkboxGroup.slots.labelandui.checkboxGroup.slots.descriptionare accepted and applied (mirroring existing RadioGroup coverage if available).Based on learnings: PR review must verify components follow patterns in .github/contributing/, themes use semantic colors, tests cover props/slots/accessibility, and documentation includes Usage/Examples/API sections.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/theme/checkbox-group.ts` around lines 9 - 10, Add a regression test that verifies typed app.config.ts slot overrides for the CheckboxGroup by asserting ui.checkboxGroup.slots.label and ui.checkboxGroup.slots.description are accepted by TypeScript and result in applied classes/styles (mirror the existing RadioGroup test pattern); update or create a unit/test file that imports the theme typing, sets app.config.ts-like overrides for ui.checkboxGroup.slots.label and .description, compiles/validates typings and renders the component to assert the overridden values are applied, and ensure the test follows the project's contributing patterns (use semantic color/class names, cover props/slots/accessibility) and mirrors the RadioGroup test structure for consistency.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/theme/checkbox-group.ts`:
- Around line 9-10: Add a regression test that verifies typed app.config.ts slot
overrides for the CheckboxGroup by asserting ui.checkboxGroup.slots.label and
ui.checkboxGroup.slots.description are accepted by TypeScript and result in
applied classes/styles (mirror the existing RadioGroup test pattern); update or
create a unit/test file that imports the theme typing, sets app.config.ts-like
overrides for ui.checkboxGroup.slots.label and .description, compiles/validates
typings and renders the component to assert the overridden values are applied,
and ensure the test follows the project's contributing patterns (use semantic
color/class names, cover props/slots/accessibility) and mirrors the RadioGroup
test structure for consistency.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3262fe1d-72cc-4172-8b7f-ea39f2f2ead1
📒 Files selected for processing (1)
src/theme/checkbox-group.ts
commit: |
Per #6337, the
CheckboxGrouptheme only declaresroot,fieldset,legend, anditemslots, even thoughCheckboxGroupSlotsdefineslabelanddescriptionslots that get forwarded to each innerCheckbox.As a result, declaring:
in
app.config.tsraises a TypeScript error becauselabelis not a known key of the slots object.This PR adds
labelanddescriptionto the slots object, matching the existingRadioGrouptheme pattern. Both keys become typeable inapp.config.tsand pick up sensible defaults consistent with RadioGroup.Closes #6337