BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/better-auth-ui/user-view

User View

better-auth-ui/user-view
FreeComponent

Renders a user view that shows the user's avatar alongside their name and email.

Live preview

live · rendered by the registry
Rendered by better-auth-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://better-auth-ui.com/r/user-view.json

Source

src/components/auth/user/user-view.tsxbetter-auth-ui.com/r/user-view.json
1"use client"
2
3import {
4 type UsernameAuthClient,
5 useAuth,
6 useSession
7} from "@better-auth-ui/react"
8import type { User } from "better-auth"
9
10import { Skeleton } from "@/components/ui/skeleton"
11import { cn } from "@/lib/utils"
12import { UserAvatar } from "./user-avatar"
13
14export type UserViewProps = {
15 className?: string
16 isPending?: boolean
17 /**
18 * When true, the subtitle line (email when name/username is shown) is hidden.
19 * @default false
20 */
21 hideSubtitle?: boolean
22 /** @remarks `User` */
23 user?: Partial<User> & {
24 username?: string | null
25 displayUsername?: string | null
26 }
27}
28
29/**
30 * Render a compact user item with an avatar, a primary label (display username, name, or email), and an optional subtitle (email).
31 *
32 * @param isPending - If true and no `user` prop is provided, renders a loading skeleton instead of user details
33 * @param className - Additional CSS classes applied to the outer container
34 * @param hideSubtitle - When true, omits the muted subtitle row under the primary label
35 * @param user - Optional user object to display; when omitted the current session user is used
36 * @returns A React element showing the user's avatar with their identifying information
37 */
38export function UserView({
39 className,
40 isPending,
41 hideSubtitle = false,
42 user
43}: UserViewProps) {
44 const { authClient } = useAuth()
45 const { data: session, isPending: sessionPending } = useSession(
46 authClient as UsernameAuthClient,
47 { enabled: !user && !isPending }
48 )
49
50 const resolvedUser = user ?? session?.user
51
52 if ((isPending || sessionPending) && !user) {
53 return (
54 <div className={cn("flex items-center gap-2 min-w-0", className)}>
55 <UserAvatar isPending />
56
57 <div className="grid flex-1 gap-1 text-left text-sm">
58 <Skeleton className="h-4 w-24" />
59
60 {!hideSubtitle && <Skeleton className="h-3 w-32" />}
61 </div>
62 </div>
63 )
64 }
65
66 return (
67 <div className={cn("flex items-center gap-2 min-w-0", className)}>
68 <UserAvatar user={resolvedUser as User | undefined} />
69
70 <div className="grid min-w-0 flex-1 text-left text-sm leading-tight">
71 <span className="truncate font-medium text-foreground">
72 {resolvedUser?.displayUsername ||
73 resolvedUser?.name ||
74 resolvedUser?.email}
75 </span>
76
77 {!hideSubtitle &&
78 (resolvedUser?.displayUsername || resolvedUser?.name) && (
79// … truncated

What it pulls in

npm packages

  • @better-auth-ui/react@latest
  • @better-auth-ui/core@latest
  • better-auth

Other registry items

  • skeleton
  • https://better-auth-ui.com/r/radix-nova/user-avatar.json

Files it writes

  • src/components/auth/user/user-view.tsx

Facts

Registry
better-auth-ui
Type
registry:component
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on better-auth-ui better-auth-ui.com better-auth-ui/better-auth-ui on GitHub Raw registry item This item as JSON

More from better-auth-ui

All 49 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Account Settingsaccount-settingsbetter-auth-uiComponentsFree2 deps
Active Sessionsactive-sessionsbetter-auth-uiComponentsFree5 deps · 2 files
Additional Fieldadditional-fieldbetter-auth-uiComponentsFree5 deps
Adminadminbetter-auth-uiComponentsFree4 deps · 3 files
Anonymousanonymousbetter-auth-uiComponentsFree4 deps · 3 files
API Keyapi-keybetter-auth-uiComponentsFree4 deps · 10 files
Authauthbetter-auth-uiComponentsFree2 deps
Auth Providerauth-providerbetter-auth-uiComponentsFree4 deps · 2 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex