Providing feedback

From ancoleman/ai-design-components · View interactive version

Providing feedback is an AI agent skill from the GitHub repository ancoleman/ai-design-components. Implements feedback and notification systems including toasts, alerts, modals, progress indicators, and error states. Use when communicating system state, displaying messages, confirming actions, or showing errors.

How to use this skill

Skill file

Providing User Feedback and Notifications

This skill implements comprehensive feedback and notification systems that enhance all other component skills by providing consistent patterns for communicating system state, displaying messages, and handling user confirmations.

When to Use This Skill

Activate this skill when:

Feedback Type Decision Matrix

Choose the appropriate feedback mechanism based on urgency and attention requirements:

Critical + Blocking       → Modal Dialog
Important + Non-blocking  → Alert Banner
Success/Info + Temporary  → Toast/Snackbar
Contextual Help          → Tooltip/Popover
In-progress              → Progress Indicator
No Data                  → Empty State

Quick Reference by Urgency

| Urgency Level | Component | Duration | Blocks Interaction |

|---------------|-----------|----------|-------------------|

| Critical | Modal Dialog | Until action | Yes |

| Important | Alert Banner | Until dismissed | No |

| Standard | Toast | 3-7 seconds | No |

| Contextual | Inline Message | Persistent | No |

| Help | Tooltip | On hover | No |

| Progress | Spinner/Bar | During operation | Optional |

Implementation Approach

Step 1: Determine Feedback Type

Assess the situation using these criteria:

  1. Urgency: How critical is the information?
  2. Duration: How long should it persist?
  3. Action Required: Does user need to respond?
  4. Context: Is it related to specific UI element?

Step 2: Choose Implementation Pattern

For Toasts/Snackbars:

For Modal Dialogs:

For Progress Indicators:

For Empty States:

Step 3: Implement with Recommended Libraries

Modern React Stack (Recommended):

npm install sonner @radix-ui/react-dialog

For Toasts - Use Sonner:

import { Toaster, toast } from 'sonner';

// In your app root
<Toaster position="bottom-right" />

// Trigger notifications
toast.success('Changes saved successfully');
toast.promise(saveData(), {
  loading: 'Saving...',
  success: 'Saved!',
  error: 'Failed to save'
});

For Modals - Use Radix UI:

import * as Dialog from '@radix-ui/react-dialog';

<Dialog.Root>
  <Dialog.Trigger>Open</Dialog.Trigger>
  <Dialog.Portal>
    <Dialog.Overlay />
    <Dialog.Content>
      <Dialog.Title>Confirm Action</Dialog.Title>
      <Dialog.Description>Are you sure?</Dialog.Description>
      <Dialog.Close>Cancel</Dialog.Close>
    </Dialog.Content>
  </Dialog.Portal>
</Dialog.Root>

See references/library-comparison.md for alternative libraries and selection criteria.

Step 4: Apply Accessibility Patterns

ARIA Live Regions for Announcements:

<!-- For non-critical notifications -->
<div role="status" aria-live="polite">
  File uploaded successfully
</div>

<!-- For critical alerts -->
<div role="alert" aria-live="assertive">
  Error: Failed to save
</div>

Focus Management for Modals:

  1. Save current focus before opening
  2. Move focus to first interactive element in modal
  3. Trap focus within modal (Tab cycles)
  4. Restore focus to trigger on close

See references/accessibility-feedback.md for complete patterns.

Step 5: Integrate Design Tokens

All feedback components use the design-tokens skill for consistent theming:

/* Example token usage */
.toast {
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: var(--toast-padding);
  border-radius: var(--toast-border-radius);
  box-shadow: var(--toast-shadow);
  animation-duration: var(--toast-enter-duration);
}

Token categories used:

Notification Timing Guidelines

Auto-dismiss durations:

Progress indicator thresholds:

Resources

Scripts (Token-Free Execution)

References (Detailed Documentation)

Examples (Implementation Code)

Assets (Templates and Configs)

Cross-Skill Integration

This skill enhances all other component skills:

Library Quick Comparison

| Library | Type | Size | Best For |

|---------|------|------|----------|

| Sonner | Toast | Small | Modern React 18+, accessibility |

| react-hot-toast | Toast | <5KB | Minimal bundle size |

| react-toastify | Toast | ~16KB | RTL support, mobile |

| Radix UI | Modal | Small | Design systems, headless |

| Headless UI | Modal | Small | Tailwind projects |

Choose based on project requirements. See references/library-comparison.md for detailed analysis.

Key Principles

  1. Match urgency to attention: Don't use modals for non-critical info
  2. Be consistent: Same feedback type for similar actions
  3. Provide context: Explain what happened and what to do
  4. Enable recovery: Include undo, retry, or help options
  5. Respect preferences: Honor reduced motion settings
  6. Test accessibility: Verify with screen readers and keyboard
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.