File tree Expand file tree Collapse file tree 4 files changed +77
-9
lines changed Expand file tree Collapse file tree 4 files changed +77
-9
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,20 @@ class SearchItem extends ListItemBase {
117117 @slot ( )
118118 image ! : Array < HTMLElement > ;
119119
120+ /**
121+ * Defines the secondary actionable elements.
122+ * This slot allows placing additional interactive elements (such as buttons, icons, or tags)
123+ * next to the delete button, providing flexible customization for various user actions.
124+ *
125+ * **Note:** While the slot is flexible, for consistency with design guidelines,
126+ * it's recommended to use `ui5-button` with `Transparent` design or `ui5-icon` elements.
127+ *
128+ * @public
129+ * @since 2.13.0
130+ */
131+ @slot ( )
132+ secondaryActions ! : Array < HTMLElement > ;
133+
120134 _markupText = "" ;
121135
122136 @i18n ( "@ui5/webcomponents-fiori" )
@@ -180,6 +194,10 @@ class SearchItem extends ListItemBase {
180194 get _deleteButtonTooltip ( ) {
181195 return SearchItem . i18nBundle . getText ( SEARCH_ITEM_DELETE_BUTTON ) ;
182196 }
197+
198+ get hasSecondaryActions ( ) {
199+ return ! ! this . secondaryActions . length ;
200+ }
183201}
184202
185203SearchItem . define ( ) ;
Original file line number Diff line number Diff line change @@ -44,14 +44,22 @@ export default function SearchFieldTemplate(this: SearchItem) {
4444 < span part = "subtitle" class = "ui5-search-item-description" > { this . description } </ span >
4545 </ div >
4646
47- { this . deletable &&
48- < Button class = "ui5-search-item-selected-delete"
49- design = { ButtonDesign . Transparent }
50- icon = { decline }
51- onClick = { this . _onDeleteButtonClick }
52- tooltip = { this . _deleteButtonTooltip }
53- onKeyDown = { this . _onDeleteButtonKeyDown } > </ Button >
54- }
47+ < div class = "ui5-search-item-actions-container" >
48+ { this . hasSecondaryActions &&
49+ < div class = "ui5-search-item-secondary-actions" >
50+ < slot name = "secondaryActions" > </ slot >
51+ </ div >
52+ }
53+
54+ { this . deletable &&
55+ < Button class = "ui5-search-item-selected-delete"
56+ design = { ButtonDesign . Transparent }
57+ icon = { decline }
58+ onClick = { this . _onDeleteButtonClick }
59+ tooltip = { this . _deleteButtonTooltip }
60+ onKeyDown = { this . _onDeleteButtonKeyDown } > </ Button >
61+ }
62+ </ div >
5563 </ div >
5664 </ div >
5765 </ li >
Original file line number Diff line number Diff line change 2424 flex : 1 ;
2525}
2626
27+ .ui5-search-item-actions-container {
28+ display : flex;
29+ align-items : center;
30+ gap : 0.125rem ;
31+ }
32+
2733: host ([desktop ]) .ui5-search-item-selected-delete {
2834 display : none;
2935}
3036
37+ : host ([desktop ]) .ui5-search-item-secondary-actions {
38+ display : none;
39+ }
40+
3141: host (: hover ),
3242: host (: focus-within ) {
3343 .ui5-search-item-selected-delete {
3444 display : inline-block;
3545 }
46+
47+ .ui5-search-item-secondary-actions {
48+ display : flex;
49+ }
50+ }
51+
52+ .ui5-search-item-secondary-actions {
53+ display : flex;
54+ align-items : center;
55+ gap : 0.25rem ;
3656}
3757
3858.ui5-search-item-text {
85105 white-space : nowrap;
86106 overflow : hidden;
87107 text-overflow : ellipsis;
88- }
108+ }
Original file line number Diff line number Diff line change 182182 < ui5-search id ="delete-search " show-clear-icon > </ ui5-search >
183183 </ div >
184184
185+ < div class ="container ">
186+ < ui5-label > Search with Secondary Actions - Example of flexible action slot</ ui5-label >
187+ < ui5-search id ="secondary-actions-search " show-clear-icon >
188+ < ui5-search-item text ="List Item with Favorite Action " icon ="history " deletable >
189+ < ui5-button slot ="secondaryActions " design ="Transparent " icon ="favorite " tooltip ="Add to favorites "> </ ui5-button >
190+ </ ui5-search-item >
191+ < ui5-search-item text ="List Item with Edit Action " icon ="search " deletable >
192+ < ui5-button slot ="secondaryActions " design ="Transparent " icon ="edit " tooltip ="Edit item "> </ ui5-button >
193+ </ ui5-search-item >
194+ < ui5-search-item text ="List Item with Multiple Actions " icon ="globe " deletable >
195+ < ui5-button slot ="secondaryActions " design ="Transparent " tabindex ="1 " icon ="share " tooltip ="Share "> </ ui5-button >
196+ < ui5-button slot ="secondaryActions " design ="Transparent " tabindex ="1 " icon ="copy " tooltip ="Copy "> </ ui5-button >
197+ </ ui5-search-item >
198+ < ui5-search-item text ="List Item with Tag Action " icon ="history ">
199+ < ui5-tag slot ="secondaryActions " design ="Set2 " color-scheme ="8 "> Important</ ui5-tag >
200+ </ ui5-search-item >
201+ </ ui5-search >
202+ < ui5-text style ="padding-top: 0.25rem; font-style: italic; ">
203+ Hover over search items to see secondary actions. Use Tab/Shift+Tab to navigate between action buttons and delete button.
204+ </ ui5-text >
205+ </ div >
206+
185207 < div class ="container ">
186208 < ui5-label > Search with Suggestions - Filter by typing</ ui5-label >
187209 < ui5-search id ="filtering " show-clear-icon placeholder ="Start typing ... "> </ ui5-search >
You can’t perform that action at this time.
0 commit comments