Overview
Effects describe what happens in the browser when an element is activated. They tell AI agents what side effects to expect.Core Effects
navigate
Behavior: Full page reload with URL change Use when:- Traditional links
- Form submissions that reload
- Page-to-page navigation
- External links
- Browser will navigate to new URL
- Current page will unload
- Need to wait for new page load
- Loss of current page state
modal
Behavior: Opens an overlay/dialog, page persists underneath Use when:- Lightboxes
- Confirmation dialogs
- Detail views
- Popup forms
- Modal/dialog will appear
- Page remains loaded underneath
- May need to interact with modal content
- May need to close modal afterward
async
Behavior: Updates content in-place via AJAX/fetch Use when:- Add to cart (updates cart widget)
- Form submissions (shows success message)
- Filters (updates results)
- Live search
- No navigation
- Page content will update
- Specific target element will change (if
targetspecified) - Page state preserved
Use
target:[selector] to specify which element will updatedownload
Behavior: Triggers file download Use when:- Export buttons
- Download links
- PDF generation
- Data exports
- File download will start
- Page remains loaded
- Download progress may be monitored
- File will save to downloads folder
external
Behavior: Navigates to external domain Use when:- Links to other sites
- Social media shares
- External documentation
- Third-party services
- Will leave current site
- May need user confirmation
- Different domain/origin
- Potential security considerations
AI agents may require explicit user permission before navigating to external sites
Target Modifier
Specify where async updates will appear:- AI agents know where to look for confirmation
- Can verify action succeeded
- Better error handling
- Improved user feedback
Combining Actions and Effects
action:add + effect:async
action:add + effect:async
Most common: Add to cart, wishlist, playlist
action:purchase + effect:navigate
action:purchase + effect:navigate
action:submit + effect:async
action:submit + effect:async
Modern forms: Submit without page reload
action:remove + effect:modal
action:remove + effect:modal
Confirmations: Show dialog before deleting
action:search + effect:async
action:search + effect:async
Live search: Update results in-place
Decision Tree
1
Does it navigate to new page?
Use
effect:navigate2
Does it open a modal/dialog?
Use
effect:modal3
Does it update content in-place?
Use
effect:async (+ target if specific element)4
Does it download a file?
Use
effect:download5
Does it leave your site?
Use
effect:externalBest Practices
Always Specify Effect
Every action should have a corresponding effect
Use Target with Async
Help agents verify success by specifying update target
Match Actual Behavior
Effect must match what actually happens, not what you wish happened
Test Edge Cases
Verify behavior with slow connections, errors, etc.