diff --git a/components/src/stories/Autocomplete.stories.js b/components/src/stories/Autocomplete.stories.js index d0b3198e..76f729b3 100644 --- a/components/src/stories/Autocomplete.stories.js +++ b/components/src/stories/Autocomplete.stories.js @@ -53,6 +53,24 @@ export const Validation = { }, }; +export const ExtraProps = { + name: 'Customized options text', + render: Basic.render, + args: { + ...Basic.args, + label: 'This implementation uses the "optionTextFn" and "menuProps"', + options: [ + { value: 'AR', label: 'Argentina' }, + { value: 'AD', label: 'Andorra' }, + { value: 'PL', label: 'Poland' }, + ], + propValue: 'value', + propText: 'label', + optionTextFn: (item) => `${item.label} (${item.value})`, + menuProps: { fullWidth: false }, + }, +}; + export default { title: 'Components/Autocomplete', component: Autocomplete, diff --git a/components/src/widgets/autocomplete/widget.vue b/components/src/widgets/autocomplete/widget.vue index c897559e..5ef2f6bd 100644 --- a/components/src/widgets/autocomplete/widget.vue +++ b/components/src/widgets/autocomplete/widget.vue @@ -9,11 +9,14 @@ :propValue="propValue" :rules="rules" :hint="hint" + :optionTextFn="optionTextFn" + :menuProps="menuProps" @value-change="updateSelected" >