docs: improve forms usage with examples

This commit is contained in:
Benjamin Canac
2023-06-12 14:34:12 +02:00
parent 429791dab0
commit bc81d45b2b
13 changed files with 172 additions and 36 deletions

View File

@@ -7,19 +7,24 @@ description: Display a select field.
The Select component is a wrapper around the native `<select>` HTML element. For more advanced use cases like searching or multiple selection, consider using the [SelectMenu](/forms/select-menu) component.
::component-card
---
baseProps:
name: 'select'
modelValue: 'United States'
props:
options:
- 'United States'
- 'Canada'
- 'Mexico'
excludedProps:
- options
---
Use a `v-model` to make the Select reactive alongside the `options` prop to pass an array of strings or objects.
::component-example
#default
:select-example
#code
```vue
<script setup>
const countries = ['United States', 'Canada', 'Mexico']
const country = ref(countries[0])
</script>
<template>
<USelect v-model="country" :options="countries" />
</template>
```
::
### Style