Overview
Empathize is the foundation for building intelligent search experiences. It automatically manages visibility based on configurable events and provides smooth transitions between open and closed states. The component is designed to be flexible, allowing you to compose various suggestion types within it.Key Features
- Event-Driven: Opens and closes based on customizable X events
- Focus Management: Handles focus states intelligently to maintain UX
- Animation Support: Built-in animation prop for smooth transitions
- Content Detection: Can trigger fallback search when no content available
- Flexible Composition: Acts as a container for any suggestion components
- Accessibility: Manages ARIA attributes and keyboard interactions
Component API
Props
| Name | Type | Default | Description |
|---|---|---|---|
eventsToOpenEmpathize | XEvent[] | ['UserFocusedSearchBox', 'UserIsTypingAQuery', 'UserClickedSearchBox'] | Events that trigger opening |
eventsToCloseEmpathize | XEvent[] | ['UserClosedEmpathize', 'UserSelectedASuggestion', 'UserPressedEnterKey', 'UserBlurredSearchBox'] | Events that trigger closing |
animation | Vue Component | NoAnimation | Animation component for transitions |
hasContent | boolean | true | Whether empathize has displayable content |
searchAndCloseOnNoContent | boolean | false | Trigger search and close when no content |
searchAndCloseDebounceInMs | number | 1000 | Debounce time for no-content fallback |
Events
The component emits the following X events:-
EmpathizeOpened: Emitted when empathize opens (has content and isOpen = true)- Payload:
void - Metadata: Contains module name and target element
- Payload:
-
EmpathizeClosed: Emitted when empathize closes- Payload:
void - Metadata: Contains module name and target element
- Payload:
-
UserClosedEmpathize: User manually closed empathize- Payload:
void
- Payload:
Slots
default(Required): The content to display inside the empathize layer- This is where you place your suggestion components
Configuration
The Empathize module has minimal configuration as it primarily acts as a container:Usage Examples
Basic Implementation
The simplest empathize setup with multiple suggestion types:With Animation
Add smooth transitions when opening and closing:Custom Open/Close Events
Control when empathize opens and closes with custom events:With Fallback Search
Automatically trigger a search when empathize has no content to show:Complex Layout
Create a sophisticated layout with sections and custom styling:Integration Patterns
With Search Box
Empathize works seamlessly with the SearchInput component:Mobile-Optimized
Optimize empathize for mobile devices:With Multiple Panels
Create tabbed or sectioned empathize content:Best Practices
Content Detection
Always provide reactivehasContent when using fallback search:
Event Configuration
Choose events that match your UX requirements:Animation Performance
Use lightweight animations for better performance:Accessibility
Ensure proper focus management:Troubleshooting
Empathize Not Opening
Check that events are properly configured and emitted:Empathize Closes Unexpectedly
Review close events and ensure focus is managed correctly:Content Not Displaying
Verify that child components have data:Related Components
- Query Suggestions - AI-powered query suggestions
- Popular Searches - Trending search queries
- History Queries - User search history
- Identifier Results - Product identifier matching
- Search Box - Search input component
- Base Components - Foundational UI components
