diff --git a/docs/components/content/ComponentProps.vue b/docs/components/content/ComponentProps.vue
index f91aaa7b..811014c2 100644
--- a/docs/components/content/ComponentProps.vue
+++ b/docs/components/content/ComponentProps.vue
@@ -21,7 +21,7 @@
{{ prop.default }}
{{ prop.type }}
diff --git a/docs/components/content/examples/SelectMenuExampleObjectsValueAttribute.vue b/docs/components/content/examples/SelectMenuExampleObjectsValueAttribute.vue
new file mode 100644
index 00000000..291b4ec5
--- /dev/null
+++ b/docs/components/content/examples/SelectMenuExampleObjectsValueAttribute.vue
@@ -0,0 +1,33 @@
+
+
+
+
+
+ {{ current.name }}
+
+
+
diff --git a/docs/content/3.forms/4.select-menu.md b/docs/content/3.forms/4.select-menu.md
index 8ba317c0..e3561d5a 100644
--- a/docs/content/3.forms/4.select-menu.md
+++ b/docs/content/3.forms/4.select-menu.md
@@ -108,6 +108,50 @@ const selected = ref(people[0])
```
::
+If you only want to select a single object property rather than the whole object as value, you can set the `value-attribute` property. This prop defaults to `null`.
+
+::component-example
+#default
+:select-menu-example-objects-value-attribute{class="w-full lg:w-48"}
+
+#code
+```vue
+
+
+
+
+
+ {{ current.name }}
+
+
+
+```
+::
+
### Icon
Use the `selected-icon` prop to set a different icon or change it globally in `ui.selectMenu.default.selectedIcon`. Defaults to `i-heroicons-check-20-solid`.
diff --git a/src/runtime/components/forms/SelectMenu.vue b/src/runtime/components/forms/SelectMenu.vue
index 42aa0425..c65d3455 100644
--- a/src/runtime/components/forms/SelectMenu.vue
+++ b/src/runtime/components/forms/SelectMenu.vue
@@ -70,7 +70,7 @@
v-slot="{ active, selected, disabled: optionDisabled }"
:key="index"
as="template"
- :value="option"
+ :value="valueAttribute ? option[valueAttribute] : option"
:disabled="option.disabled"
>
@@ -271,6 +271,10 @@ export default defineComponent({
type: String,
default: 'label'
},
+ valueAttribute: {
+ type: String,
+ default: null
+ },
searchAttributes: {
type: Array,
default: null