X Enterprises
nuxt-x-app

User

User identity components including cards, list items, dropdown menus, and role badges.

User

The User category provides a set of composable components for displaying user identity. XAUserCard and XAUserItem cover card and list-row contexts. XAUserMenu handles the navigation header avatar + dropdown pattern. XAUserRoleBadge renders role strings as colored badges with automatic color mapping. XAUser is a drop-in alias for XAUserCard.

Components

<XAUser />

A convenience alias that renders XAUserCard with identical props and slots. Use it when you prefer the shorter component name in templates.

<XAUser name="Jane Smith" email="jane@example.com" role="admin" />

<XAUserCard />

A compact bordered card that displays an avatar (via XAAvatar), user name, role badge, and online status indicator. Supports click events, selection state with a checkbox, and an #actions slot for trailing controls.

<!-- Flat props -->
<XAUserCard
  name="John Doe"
  email="john@example.com"
  role="admin"
  status="online"
  size="md"
/>

<!-- User object -->
<XAUserCard :user="user" clickable @click="openProfile" />

<!-- With selection -->
<XAUserCard
  :user="user"
  selectable
  :selected="selectedIds.has(user.id)"
  @select="toggleSelect"
/>

<!-- With actions -->
<XAUserCard :user="user">
  <template #actions>
    <UButton size="xs" icon="i-lucide-pencil" variant="ghost" />
  </template>
</XAUserCard>

Props

PropTypeDefaultDescription
userObjectnullUser object with name, email, avatar, role, status, department. Individual props take priority over object fields.
nameString''Display name.
emailString''Email address.
avatarString''Avatar image URL.
roleString''Role string passed to XAUserRoleBadge.
roleColorString''Override color for the role badge.
departmentString''Department or team name (available for layout use).
statusString''Online status — 'online', 'offline', 'away', or 'busy'.
sizeString'md'Card size — 'sm', 'md', or 'lg'.
clickableBooleanfalseAdds hover styles and emits click when the card is clicked.
selectedBooleanfalseHighlights the card with a primary ring.
selectableBooleanfalseShows a checkbox for multi-select scenarios.

Events

EventPayloadDescription
clickEmitted when the card is clicked (requires clickable).
selectBooleanEmitted from the checkbox when selectable is true.

Slots

SlotDescription
actionsTrailing area for action buttons. Falls back to default slot.

<XAUserItem />

A flat list row suitable for displaying users, companies, or businesses inside menus, dropdowns, or list panels. Companies and businesses render a building/store icon instead of an avatar. Supports a badge next to the name, a description line, and a chevron for navigable items.

<!-- User -->
<XAUserItem name="John Doe" email="john@example.com" status="online" />

<!-- Company -->
<XAUserItem type="company" name="Acme Inc" subtitle="Technology" />

<!-- Business -->
<XAUserItem type="business" name="Local Coffee Shop" subtitle="123 Main St" />

<!-- Clickable with actions slot -->
<XAUserItem name="Jane" clickable @click="open">
  <template #actions>
    <UButton size="xs" icon="i-lucide-mail" variant="ghost" />
  </template>
</XAUserItem>

Props

PropTypeDefaultDescription
nameStringrequiredDisplay name.
typeString'user'Entity type — 'user', 'company', or 'business'.
avatarString''Avatar image URL (users only).
emailString''Email shown as subtitle when no explicit subtitle is set.
roleString''Role shown as subtitle when no subtitle or email is set.
subtitleString''Custom subtitle — overrides email and role.
descriptionString''Second line of detail text.
statusString''Online status dot — 'online', 'offline', 'away', or 'busy' (users only).
badgeString | ObjectnullBadge next to the name. Object form: { label, color, variant }.
sizeString'md'Row size — 'sm', 'md', or 'lg'.
clickableBooleanfalseAdds hover background and emits click.
selectedBooleanfalseApplies primary highlight background.
showChevronBooleantrueShows a right-chevron when clickable is true and no actions slot is provided.

Events

EventDescription
clickEmitted when the row is clicked (requires clickable).

<XAUserMenu />

An avatar-based dropdown trigger that opens a UDropdownMenu with Profile, Settings, and Logout items. Designed for navigation headers. Supports compact mode (avatar only), optional status indicator, custom menu items via the customItems prop, and a header section inside the dropdown that shows name and email.

<!-- Basic -->
<XAUserMenu
  name="John Doe"
  email="john@example.com"
  avatar="/avatars/john.jpg"
  @profile="router.push('/profile')"
  @settings="router.push('/settings')"
  @logout="signOut()"
/>

<!-- From user object, compact -->
<XAUserMenu :user="currentUser" compact @logout="signOut()" />

<!-- Custom additional items -->
<XAUserMenu
  :user="currentUser"
  :custom-items="[[{ label: 'My Team', icon: 'i-lucide-users', onSelect: () => viewTeam() }]]"
  @logout="signOut()"
/>

Props

PropTypeDefaultDescription
userObjectnullUser object with name, email, avatar, role, status.
nameString''Display name.
emailString''Email address.
avatarString''Avatar image URL.
roleString''Role shown under name in the trigger.
statusStringnullOnline status — 'online', 'offline', 'away', or 'busy'.
sizeString'md'Avatar size — 'xs', 'sm', 'md', 'lg', or 'xl'.
compactBooleanfalseShow only the avatar (no name, chevron, or role).
showStatusBooleanfalseDisplay status indicator on the avatar.
showHeaderBooleantrueShow name/email header section inside the dropdown.
showProfileBooleantrueInclude the Profile menu item.
showSettingsBooleantrueInclude the Settings menu item.

Events

EventDescription
profileEmitted when Profile is selected.
settingsEmitted when Settings is selected.
logoutEmitted when Logout is selected.

<XAUserRoleBadge />

A thin wrapper around UBadge that auto-maps common role strings (admin, owner, manager, member, guest, etc.) to semantic colors. The mapping can be extended or overridden per instance via colorMap and color props.

<!-- Auto-colored -->
<XAUserRoleBadge role="admin" />

<!-- Custom color override -->
<XAUserRoleBadge role="vip" color="success" />

<!-- Extend the default color map -->
<XAUserRoleBadge role="developer" :color-map="{ developer: 'primary' }" />

Props

PropTypeDefaultDescription
roleStringrequiredRole string to display and auto-map to a color.
labelString''Custom label text (defaults to formatted role value).
colorString''Override the auto-mapped color.
colorMapObject{}Additional role-to-color mappings merged with the built-in map.
variantString'soft'Badge variant passed to UBadge.
sizeString'sm'Badge size — 'xs', 'sm', or 'md'.
badgeClassString''Additional CSS classes applied to the badge element.

AI Context

category: User
package: "@xenterprises/nuxt-x-app"
use-when: >
  Use XAUserCard (or its alias XAUser) for bordered card representations of a user,
  such as in grid layouts or selection lists. Use XAUserItem for flat list rows inside
  menus, dropdowns, or list panels — it also handles company and business entity types.
  Use XAUserMenu in navigation headers where a user avatar triggers a profile/logout
  dropdown. Use XAUserRoleBadge anywhere a role string needs to be rendered as a
  color-coded badge; it can be used standalone or is automatically included by
  XAUserCard when a role is present.
Copyright © 2026