Skip to content

fix(CheckboxGroup): add label and description to theme slots#6351

Open
SAY-5 wants to merge 1 commit intonuxt:v4from
SAY-5:fix/checkbox-group-add-label-description-slots
Open

fix(CheckboxGroup): add label and description to theme slots#6351
SAY-5 wants to merge 1 commit intonuxt:v4from
SAY-5:fix/checkbox-group-add-label-description-slots

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented Apr 15, 2026

Per #6337, the CheckboxGroup theme only declares root, fieldset, legend, and item slots, even though CheckboxGroupSlots defines label and description slots that get forwarded to each inner Checkbox.

As a result, declaring:

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.

This PR adds label and description to the slots object, matching the existing RadioGroup theme pattern. Both keys become typeable in app.config.ts and pick up sensible defaults consistent with RadioGroup.

Closes #6337

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
@SAY-5 SAY-5 requested a review from benjamincanac as a code owner April 15, 2026 03:21
@github-actions github-actions Bot added the v4 #4488 label Apr 15, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 15, 2026

📝 Walkthrough

Walkthrough

The change extends the slots configuration in the checkbox-group theme file by adding two new publicly exposed slot keys: label (mapped to 'block font-medium text-default') and description (mapped to 'text-muted'). The existing item slot definition remains unchanged. This adds missing type definitions for these slots.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding label and description slots to the CheckboxGroup theme configuration.
Description check ✅ Passed The description clearly explains the issue, the solution, and references the related issue #6337, providing sufficient context for understanding the change.
Linked Issues check ✅ Passed The PR fully addresses issue #6337 by adding label and description slots to the CheckboxGroup theme, making them properly typed for app.config.ts configuration.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue objective of exposing label and description slots in the CheckboxGroup theme.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/theme/checkbox-group.ts (1)

9-10: Please add a regression test for typed app.config.ts slot overrides.

Given this is a typing-surface fix, add/update a test that asserts ui.checkboxGroup.slots.label and ui.checkboxGroup.slots.description are 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

📥 Commits

Reviewing files that changed from the base of the PR and between b7874b2 and 3864719.

📒 Files selected for processing (1)
  • src/theme/checkbox-group.ts

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 15, 2026

npm i https://pkg.pr.new/@nuxt/ui@6351

commit: 3864719

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

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CheckboxGroup label slot type missing in app.config.ts

1 participant