Skip to content

feat(component): AlertGroup component#6143

Closed
RasmusPJustesen wants to merge 5 commits intonuxt:v4from
RasmusPJustesen:v4
Closed

feat(component): AlertGroup component#6143
RasmusPJustesen wants to merge 5 commits intonuxt:v4from
RasmusPJustesen:v4

Conversation

@RasmusPJustesen
Copy link

@RasmusPJustesen RasmusPJustesen commented Mar 3, 2026

This is the first time I ever contribute to a open-source library - please correct me if I am missing anything

🔗 Linked issue

Resolves: #6142

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

On a project I am working on we use Alerts are a form of "user tasks" that the user should handle before a deadline.
The UI quickly became crazy when there there more then 2 "user tasks" at the same time. therefore I built a AlertGroup component inspired by how Toasts are stacked when toaster has expand: true.

By inspecting the toast and toaster code, found out that i cannot use the same approach with transform translate and position absolute. Therefore this component is using negative margin to move the rest of the elements on the page when the group expands the stacked alerts.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

👀 Preview

alertgroup

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 575c45a and 9a078ba.

📒 Files selected for processing (1)
  • playgrounds/nuxt/app/pages/components/alert-group.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • playgrounds/nuxt/app/pages/components/alert-group.vue

📝 Walkthrough

Walkthrough

Adds a new AlertGroup Vue component at src/runtime/components/AlertGroup.vue that renders a list of alerts with stacking/expandable behavior. Props: items (AlertProps[]), expand (boolean, default false), max (number, default 5); exports AlertGroupProps. Adds theme defaults in src/theme/alert-group.ts and re-exports it from src/theme/index.ts. Re-exports component types from src/runtime/types/index.ts. Adds a Nuxt playground page and navigation entry demonstrating the component (playgrounds/nuxt/app/pages/components/alert-group.vue and playgrounds/nuxt/app/composables/useNavigation.ts).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(component): AlertGroup component' clearly and specifically describes the main change: introducing a new AlertGroup component using conventional commit format.
Description check ✅ Passed The description is well-related to the changeset, explaining the motivation for AlertGroup, implementation approach, and linking to the relevant issue.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #6142: provides an AlertGroup component that stacks alerts using negative margin-top, accepts an items prop as an array, and uses an alternative approach suitable for document flow.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the AlertGroup component as specified in issue #6142. The playground demo and theme exports are supporting additions for the core feature.
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
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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/runtime/components/AlertGroup.vue`:
- Line 53: The collapsed width calculation can go negative for large index
values; update the expression in AlertGroup.vue where width is set (the expanded
? ... : `${100 - index * 3}%` expression) to clamp the percentage to a safe
minimum (e.g., use Math.max to ensure at least 0 or a chosen MIN_PERCENT) so the
resulting CSS is always valid; keep the expanded branch returning '100%' and
apply the clamp to the collapsed branch using the existing index variable.
- Around line 16-23: The AlertGroup component's props declaration (defineProps
in AlertGroup.vue) is missing the class and ui props used elsewhere (props.class
and useComponentUI), which breaks type safety; update the defineProps generic to
include class?: string | Record<string, boolean> (or the same type used across
components) and ui?: ComponentUI (or the shared ui prop type used by
Alert/Badge) and add corresponding defaults in withDefaults so props.class and
props.ui are properly typed and available to the useComponentUI call and any
class overrides.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 390060c and ba90d97.

📒 Files selected for processing (2)
  • src/runtime/components/AlertGroup.vue
  • src/theme/alert-group.ts

@github-actions github-actions bot added the v4 #4488 label Mar 3, 2026
Copy link
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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/theme/alert-group.ts`:
- Line 6: Add a single trailing newline character after the final closing brace
('}') at the end of alert-group.ts so the file ends with one EOF newline (fixes
the `@stylistic/eol-last` lint failure); ensure there are no extra blank
lines—just one final newline.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba90d97 and 02dfeec.

📒 Files selected for processing (6)
  • playgrounds/nuxt/app/composables/useNavigation.ts
  • playgrounds/nuxt/app/pages/components/alert-group.vue
  • src/runtime/components/AlertGroup.vue
  • src/runtime/types/index.ts
  • src/theme/alert-group.ts
  • src/theme/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/runtime/components/AlertGroup.vue

Copy link
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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@playgrounds/nuxt/app/pages/components/alert-group.vue`:
- Around line 1-52: The file uses Vue's reactive() in the <script setup> block
(const attrs = reactive({...})) but never imports it; add an import for reactive
from 'vue' at the top of the script (e.g., import { reactive } from 'vue') so
the reactive symbol used in the const attrs declaration is defined and linting
passes.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b85f9cc and 575c45a.

📒 Files selected for processing (1)
  • playgrounds/nuxt/app/pages/components/alert-group.vue

@benjamincanac
Copy link
Member

Closing this, see #6142 (comment)

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.

AlertGroup component

2 participants