Collapsible Search β
Displays a search form with collapsible and expandable functionality, suitable for scenarios with numerous search items. The collapsible feature saves page space and enhances user experience.
Collapsible Search Demo β
Collapsible Functionality Explanation β
Basic Configuration β
Control collapsible behavior through fold
and foldRows
parameters:
const searchOptions = {
fold: true, // Enable collapsible feature
foldRows: 2, // Display 2 rows by default
}
2
3
4
Custom Button Text β
Customize collapsible button text through text
configuration:
const searchOptions = {
text: {
isFoldBtn: 'Show more search conditions',
notFoldBtn: 'Hide some search conditions'
}
}
2
3
4
5
6
Programmatic Control β
Control collapsible state through component instance methods:
// Toggle collapsible state
searchRef.value?.foldToggle()
// Get current collapsible state
const isFold = searchRef.value?.getFold()
2
3
4
5
Usage Scenarios β
1. Backend Management Systems β
In admin backends where multiple search conditions are typically required, the collapsible feature maintains interface cleanliness.
2. Data Analysis Platforms β
Complex data filtering conditions display commonly used criteria while hiding advanced conditions in the collapsible area.
3. Mobile Adaptation β
On mobile devices with limited screen space, the collapsible feature is particularly important.
Collapsible Strategies β
Smart Collapsing β
- Automatically calculates the number of search items to collapse
- Prioritizes displaying the most commonly used search conditions
- Keeps action buttons always visible
Responsive Collapsing β
- Automatically adjusts the number of collapsed rows based on screen size
- Defaults to more compact display on mobile
- Smooth expand/collapse animation effects
Key Features β
- π± Mobile-friendly design
- π Smooth expand/collapse animations
- π Flexible fold row configuration
- π Customizable button text
- β‘ Programmatic state control
Best Practices β
1. Reasonable Fold Row Settings β
Set the foldRows
parameter appropriately based on actual business scenarios and page layout:
// Recommended 2-3 rows for desktop
// Recommended 1-2 rows for mobile
const searchOptions = {
foldRows: window.innerWidth < 768 ? 1 : 2
}
2
3
4
5
2. Optimize Search Item Order β
Place the most commonly used search conditions first to ensure visibility when collapsed.
3. Provide State Indicators β
Clearly indicate the current collapsed state through custom button text or icons.
Related Links β
- Responsive Layout - Learn about adaptive display on different screens
- Custom Actions - Learn about custom action buttons
- Basic Usage - Learn about basic search functionality