Skip to content

AvatarSelect

A searchable select dropdown where each option displays a BaseAvatar with the user's initials alongside their name. Ideal for user/member selection fields.

Usage

vue
<script setup>
import { ref } from 'vue'
import { AvatarSelect } from 'praxis-vue-ui'

const users = [
  { id: 1, name: 'Alice Johnson', email: 'alice@example.com' },
  { id: 2, name: 'Bob Smith', email: 'bob@example.com' },
]
const selected = ref(null)
</script>

<template>
  <AvatarSelect
    v-model="selected"
    :options="users"
    label="Assign To"
    placeholder="Select a team member..."
  />
</template>

Props

PropTypeDefaultDescription
modelValueunknownnullCurrently selected user. Use with v-model.
optionsrequiredobject[]Array of user objects. Must have a name property for avatar initials.
labelstringundefinedField label.
placeholderstring'Select...'Dropdown placeholder.
disabledbooleanfalseDisables the select.
requiredbooleanfalseMarks as required.
reduce(option) => unknownoption => option.idValue extractor.

Emits

EventPayloadDescription
update:modelValueunknownEmitted on selection change.

Built with VitePress