Selection
Menus that can be used in single or multiple selection form
Examples
Radio mode
Radio button groups allow the user to select an option from a mutually exclusive list of options
Response data for item switching events
<SelectMenuBody>
<SelectMenuHeader>Radio group</SelectMenuHeader>
<SelectMenuRadioGroup>
<SelectMenuRadioItem
value="radio1"
disabled
>radio1</SelectMenuRadioItem>
<SelectMenuRadioItem value="radio2">radio2</SelectMenuRadioItem>
<SelectMenuRadioItem value="radio3">radio3</SelectMenuRadioItem>
</SelectMenuRadioGroup>
</SelectMenuBody>
import {
SelectMenuDropdown,
SelectMenuTrigger,
SelectMenuBody,
SelectMenuHeader,
SelectMenuRadioGroup,
SelectMenuRadioItem
} from 'v-selectmenu'
Checkbox mode
CheckboxGroup allows the user to select one or more items from a list of options
Response data for item switching events
<SelectMenuBody>
<SelectMenuHeader>Checkbox group</SelectMenuHeader>
<SelectMenuCheckboxGroup>
<SelectMenuCheckboxItem
value="checkbox1"
>checkbox1</SelectMenuCheckboxItem>
<SelectMenuCheckboxItem
value="checkbox2"
disabled
>checkbox2</SelectMenuCheckboxItem>
<SelectMenuCheckboxItem
value="checkbox3"
>checkbox3</SelectMenuCheckboxItem>
</SelectMenuCheckboxGroup>
</SelectMenuBody>
import {
SelectMenuDropdown,
SelectMenuTrigger,
SelectMenuBody,
SelectMenuHeader,
SelectMenuCheckboxGroup,
SelectMenuCheckboxItem
} from 'v-selectmenu'
Default selection
Sets the specified items to be checked by default
<!-- radio group with default value -->
<SelectMenuRadioGroup v-model="radioGroupActive">
...
</SelectMenuRadioGroup>
<!-- checkbox group with default value -->
<SelectMenuCheckboxGroup v-model="checkboxGroupActive">
...
</SelectMenuCheckboxGroup>
import { ref } from 'vue'
const radioGroupActive = ref('radio2')
const checkboxGroupActive = ref(['checkbox1', 'checkbox3'])
Radio group
Checkbox group
Clear selection
Clear selected items
// clear radio group selection
radioGroupActive.value = ''
// clear checkbox group selection
checkboxGroupActive.value = []
Close menu after selection
Close the menu after item selection
<SelectMenuRadioGroup :hideOnSelection="hideOnSelection">
...
</SelectMenuRadioGroup>
<SelectMenuCheckboxGroup :hideOnSelection="hideOnSelection">
...
</SelectMenuCheckboxGroup>
import { ref } from 'vue'
const hideOnSelection = ref(false)
Radio group
Checkbox group
Props
Group props
SelectMenuRadioGroup
, SelectMenuCheckboxGroup
props
type SelectionValue = string | number
interface RadioGroupProps {
modelValue?: SelectionValue
/**
* @default true
*/
hideOnSelection?: boolean
}
interface CheckboxGroupProps {
modelValue?: SelectionValue[]
/**
* @default false
*/
hideOnSelection?: boolean
}
Item props
SelectMenuRadioItem
, SelectMenuCheckboxItem
props
interface SelectionItemProps {
value: SelectionValue
/**
* @default false
*/
disabled?: boolean
}
Events
SelectMenuRadioGroup
, SelectMenuCheckboxGroup
response events
update:modelValue
Responding to selection changes
// radio group
`update:modelValue`: (value: SelectionValue) => void
// checkbox group
`update:modelValue`: (value: SelectionValue[]) => void
change
Responding to selection changes
// radio group
change: (data: SelectionValue) => void
// checkbox group
change: (data: SelectionValue[]) => void
Slots
Group slots
SelectMenuRadioGroup
, SelectMenuCheckboxGroup
slots
default
default slot
Item slots
SelectMenuRadioItem
, SelectMenuCheckboxItem
slots
prepend
prepend slotdefault
default slotappend
tail slot, aligned right