-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
feat(alert): added AlertAction component #9190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@Inv1x is attempting to deploy a commit to the shadcn-pro Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds an AlertAction component to display action elements (buttons, badges) within alerts. The component implements responsive behavior that stacks actions at the bottom on mobile and positions them absolutely on the right side at desktop breakpoints.
Key Changes:
- New
AlertActioncomponent withdata-slot="alert-action"attribute - Responsive layout using
sm:breakpoint for mobile-first design - Updates to Alert base styles to accommodate the action component with conditional padding
Reviewed changes
Copilot reviewed 25 out of 38 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
apps/v4/registry/new-york-v4/ui/alert.tsx |
Adds AlertAction component and updates Alert styles for responsive action positioning |
apps/v4/registry/new-york-v4/examples/alert-action.tsx |
New example demonstrating AlertAction with buttons and badges |
apps/v4/registry/new-york-v4/examples/_registry.ts |
Registers the new alert-action example |
apps/v4/registry/__index__.tsx |
Auto-generated index including the new example |
apps/v4/public/r/styles/*/vercel.json |
Auto-generated JSON files (no actionable changes) |
apps/v4/public/r/styles/*/github.json |
Auto-generated JSON files (no actionable changes) |
apps/v4/public/r/styles/new-york-v4/registry.json |
Adds alert-action example to registry |
apps/v4/public/r/styles/new-york-v4/alert.json |
Updates alert component with AlertAction export |
apps/v4/public/r/styles/new-york-v4/alert-action.json |
New registry entry for alert-action example |
apps/v4/content/docs/components/alert.mdx |
Documentation updates showing AlertAction usage |
The implementation looks solid with proper responsive design patterns and clear documentation. No critical issues were identified during the review.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Changes SummaryThis PR adds a new AlertAction component to the shadcn/ui Alert component, allowing users to display action buttons or badges within alerts. The component implements responsive behavior - stacking below content on mobile and absolute positioning on the right side on desktop (sm: breakpoint). The change includes documentation updates, registry entries, and example code. Type: feature Components Affected: Alert, AlertAction Architecture Impact
Risk Areas: CSS grid layout complexity - the AlertAction positioning relies on grid column placement which could conflict with existing alert content structure, Absolute positioning on desktop (sm:) may cause overlap issues with long alert titles or when multiple actions are present, Fixed pr-20 padding may not accommodate all action content widths Suggestions
Full review in progress... | Powered by diffray |
Review Summary
Validated 6 issues: 1 kept (medium - valid accessibility concern about role='alert'), 5 filtered (low value - don't match project conventions or are low impact) Issues Found: 1📋 Full issue list (click to expand)🟡 MEDIUM - Alert component always uses role="alert" which may be too assertiveCategory: quality File: Description: The Alert component hardcodes role="alert" which implies aria-live="assertive". This is appropriate for urgent error messages but may be too aggressive for informational status updates. Suggestion: Consider adding a variant prop to allow choosing between role="alert" (for urgent messages like errors) and role="status" (for informational updates like success confirmations). The role could default based on the variant - destructive variants use role="alert", while default variants use role="status". Confidence: 70% Rule: Powered by diffray - Multi-Agent Code Review Agent |
Summary
AlertActioncomponent to display actions (buttons, badges) within alertsChanges
AlertActioncomponent withdata-slot="alert-action"sm:breakpointalert-actionexample demonstrating usage with buttons and badgesUsage
Examples:

