Skip to main content

<UserDropdown />

The UserDropdown component renders an avatar button that opens a dropdown menu with user information and common actions like viewing the profile and signing out. You can insert additional menu items between the Profile link and Sign Out.

Usage

Basic Usage

src/Header.vue
<script setup>
import { UserDropdown } from '@thunderid/vue'
</script>

<template>
<header>
<UserDropdown />
</header>
</template>

Custom Menu Items

Add extra menu items between the built-in Profile link and Sign Out. Each item can optionally render with an icon, mark itself as danger for destructive styling, or insert a divider line above with separatorBefore.

src/Header.vue
<script setup>
import { h } from 'vue'
import { UserDropdown } from '@thunderid/vue'
import { Settings, HelpCircle } from 'lucide-vue-next'

const menuItems = [
{
label: 'Settings',
icon: h(Settings, { size: 15 }),
onClick: () => { /* navigate to settings */ },
},
{
label: 'Help',
icon: h(HelpCircle, { size: 15 }),
onClick: () => { /* open help */ },
separatorBefore: true,
},
]
</script>

<template>
<UserDropdown :menu-items="menuItems" />
</template>

Compact Variant

Render a smaller, left-aligned dropdown without the chevron:

src/Header.vue
<script setup>
import { UserDropdown } from '@thunderid/vue'
</script>

<template>
<UserDropdown size="sm" menu-align="left" />
</template>

Props

PropTypeRequiredDescription
menuItemsDropdownMenuItem[]Extra items inserted between the Profile link and Sign Out
menuAlign'auto' | 'left' | 'right'How the dropdown panel aligns relative to the trigger. Defaults to 'auto'.
showChevronbooleanWhether to render the animated down-chevron beside the avatar. Defaults to false.
size'sm' | 'md' | 'lg'Overall density of the dropdown. Defaults to 'md'.
classNamestringExtra CSS class added to the root element

Events

EventDescription
profileClickEmitted when the user clicks the Profile menu item
PropertyTypeDescription
labelstringThe menu item's label text
onClick() => voidHandler invoked when the item is clicked
iconVNodeOptional icon rendered to the left of the label
dangerbooleanWhen true, applies destructive (red) styling
separatorBeforebooleanWhen true, inserts a divider line before this item
ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© WSO2 LLC. All rights reserved.