Skip to content

Conversation

@mrnasil
Copy link

@mrnasil mrnasil commented Jan 27, 2026

📚 Description
This PR adds support for displaying icons in
CodeGroup
tabs using the new metadata syntax [filename|icon|position].

⚠️ Dependency: This feature relies on parser changes introduced in nuxt-content/mdc#462. The functionality will fully work once that PR is merged and @nuxtjs/mdc is updated.

Changes:

  • Updated
    CodeGroup.vue
    to handle icon and iconPosition props.

  • Updated documentation with examples demonstrating the new icon syntax using TypeScript and Vue code blocks.

@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

This pull request adds icon positioning functionality to the CodeGroup component. The component now supports an iconPosition property that allows icons to be rendered on either the left (default) or right side of code group triggers. The accompanying documentation has been updated with a new "Icon Position" section containing usage examples in TypeScript and Vue, along with updated class token references throughout the documentation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately describes the main changes: updating CodeGroup documentation with examples for the new icon syntax and positioning feature.
Description check ✅ Passed The pull request description is directly related to the changeset, explaining the icon positioning feature, the documentation updates, and the dependency on nuxt-content/mdc changes.
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
  • Post copyable unit tests in a comment

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

@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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/content/docs/4.typography/code-group.md`:
- Around line 68-106: MD018 is triggered by the new '#code' MDC slot marker
which must be written without a leading space; suppress MD018 locally around
that marker by wrapping the affected block with markdownlint directives. Insert
<!-- markdownlint-disable MD018 --> immediately before the ::code-group / `#code`
region containing the '#code' slot marker and add <!-- markdownlint-enable MD018
--> immediately after that region so the '#code' line (and its surrounding
fenced MDC block) remain unchanged while the linter is disabled only for that
snippet.
🧹 Nitpick comments (1)
src/runtime/components/prose/CodeGroup.vue (1)

48-70: Consider narrowing and normalizing iconPosition.

This gives better TS hints and avoids typos silently falling back to left alignment.

♻️ Suggested refinement
-const items = computed<{
+const items = computed<{
   index: number
   label: string
   icon: string
-  iconPosition: string
+  iconPosition?: 'left' | 'right'
   component: any
 }[]>(() => {
@@
   return {
     label: slot.props?.filename || slot.props?.label || `${index}`,
     icon: slot.props?.icon,
-    iconPosition: slot.props?.iconPosition,
+    iconPosition: slot.props?.iconPosition === 'right' ? 'right' : 'left',
     component: slot
   }
 }

Comment on lines +68 to +106
## Icon Position

Use the `iconPosition` attribute to position the icon on the right side of the label.

::code-preview{class="[&>div]:_:my-0 [&>div]:_:w-full"}

:::code-group

```ts [Script|logos:typescript|right]
console.log("Hello World");
```

```vue [Component|logos:vue]
<template>
<h1>Hello World</h1>
</template>
```

:::

#code

````mdc
::code-group
```ts [Script|logos:typescript|right]
console.log('Hello World')
```
```vue [Component|logos:vue]
<template>
<h1>Hello World</h1>
</template>
```
::
````

::
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix MD018 for the new #code slot marker.

markdownlint flags the new #code line. If the no-space form is required for MDC slots, suppress the rule locally to avoid CI failures.

✅ Suggested fix
+<!-- markdownlint-disable-next-line MD018 -->
 `#code`
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

88-88: No space after hash on atx style heading

(MD018, no-missing-space-atx)

🤖 Prompt for AI Agents
In `@docs/content/docs/4.typography/code-group.md` around lines 68 - 106, MD018 is
triggered by the new '#code' MDC slot marker which must be written without a
leading space; suppress MD018 locally around that marker by wrapping the
affected block with markdownlint directives. Insert <!-- markdownlint-disable
MD018 --> immediately before the ::code-group / `#code` region containing the
'#code' slot marker and add <!-- markdownlint-enable MD018 --> immediately after
that region so the '#code' line (and its surrounding fenced MDC block) remain
unchanged while the linter is disabled only for that snippet.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 27, 2026

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

commit: 2abdf78

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants