mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-29 19:30:37 +01:00
feat(InputMenu): allows to customize labels (#2295)
This commit is contained in:
@@ -174,6 +174,8 @@ componentProps:
|
|||||||
|
|
||||||
Use the `#option-empty` slot to customize the content displayed when the `searchable` prop is `true` and there is no options. You will have access to the `query` property in the slot scope.
|
Use the `#option-empty` slot to customize the content displayed when the `searchable` prop is `true` and there is no options. You will have access to the `query` property in the slot scope.
|
||||||
|
|
||||||
|
You can also configure this globally through the `ui.inputMenu.default.optionEmpty.label` config. The token `{query}` will be replaced by `query` property. Defaults to `No results for "{query}".`.
|
||||||
|
|
||||||
::component-example
|
::component-example
|
||||||
---
|
---
|
||||||
component: 'input-menu-example-option-empty-slot'
|
component: 'input-menu-example-option-empty-slot'
|
||||||
@@ -186,6 +188,8 @@ componentProps:
|
|||||||
|
|
||||||
Use the `#empty` slot to customize the content displayed when there is no options. Defaults to `No options.`.
|
Use the `#empty` slot to customize the content displayed when there is no options. Defaults to `No options.`.
|
||||||
|
|
||||||
|
You can also configure this globally through the `ui.inputMenu.default.empty.label` config. Defaults to `No options.`.
|
||||||
|
|
||||||
::component-example
|
::component-example
|
||||||
---
|
---
|
||||||
component: 'input-menu-example-empty-slot'
|
component: 'input-menu-example-empty-slot'
|
||||||
|
|||||||
@@ -75,12 +75,12 @@
|
|||||||
|
|
||||||
<p v-if="query && !filteredOptions.length" :class="uiMenu.option.empty">
|
<p v-if="query && !filteredOptions.length" :class="uiMenu.option.empty">
|
||||||
<slot name="option-empty" :query="query">
|
<slot name="option-empty" :query="query">
|
||||||
No results for "{{ query }}".
|
{{ uiMenu.default.optionEmpty.label.replace('{query}', query) }}
|
||||||
</slot>
|
</slot>
|
||||||
</p>
|
</p>
|
||||||
<p v-else-if="!filteredOptions.length" :class="uiMenu.empty">
|
<p v-else-if="!filteredOptions.length" :class="uiMenu.empty">
|
||||||
<slot name="empty" :query="query">
|
<slot name="empty" :query="query">
|
||||||
No options.
|
{{ uiMenu.default.empty.label }}
|
||||||
</slot>
|
</slot>
|
||||||
</p>
|
</p>
|
||||||
</HComboboxOptions>
|
</HComboboxOptions>
|
||||||
|
|||||||
@@ -53,7 +53,13 @@ export default {
|
|||||||
},
|
},
|
||||||
default: {
|
default: {
|
||||||
selectedIcon: 'i-heroicons-check-20-solid',
|
selectedIcon: 'i-heroicons-check-20-solid',
|
||||||
trailingIcon: 'i-heroicons-chevron-down-20-solid'
|
trailingIcon: 'i-heroicons-chevron-down-20-solid',
|
||||||
|
empty: {
|
||||||
|
label: 'No options.'
|
||||||
|
},
|
||||||
|
optionEmpty: {
|
||||||
|
label: 'No results for "{query}".'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
arrow: {
|
arrow: {
|
||||||
...arrow,
|
...arrow,
|
||||||
|
|||||||
Reference in New Issue
Block a user