Data Display

User

Display a user profile with avatar, name, description, and optional status chip. Supports horizontal and vertical layouts, 9 sizes, and can render as a clickable link.

Playground

Experiment with different props in real-time.

JD

John Doe

Software Engineer

Basic Usage

Provide a name, description, and avatar.

JD

John Doe

Software Engineer

<script lang="ts">
  import { User } from 'sv5ui';
</script>

<User
  name="John Doe"
  description="Software Engineer"
  avatar={{ src: 'https://i.pravatar.cc/150?u=john', alt: 'John Doe' }}
/>

Sizes

9 sizes from 3xs to 3xl.

xs
J

Jane

Designer

sm
J

Jane

Designer

md
J

Jane

Designer

lg
J

Jane

Designer

xl
J

Jane

Designer

2xl
J

Jane

Designer

3xl
J

Jane

Designer

<User name="Jane" description="Designer" avatar={{ alt: 'Jane' }} size="xs" />
<User name="Jane" description="Designer" avatar={{ alt: 'Jane' }} size="sm" />
<User name="Jane" description="Designer" avatar={{ alt: 'Jane' }} size="md" />
<User name="Jane" description="Designer" avatar={{ alt: 'Jane' }} size="lg" />
<User name="Jane" description="Designer" avatar={{ alt: 'Jane' }} size="xl" />
<User name="Jane" description="Designer" avatar={{ alt: 'Jane' }} size="2xl" />
<User name="Jane" description="Designer" avatar={{ alt: 'Jane' }} size="3xl" />

Orientation

Switch between horizontal and vertical layouts.

JD

John Doe

Software Engineer

JD

John Doe

Software Engineer

<User
  name="John Doe"
  description="Software Engineer"
  avatar={{ alt: 'John Doe' }}
  orientation="horizontal"
/>

<User
  name="John Doe"
  description="Software Engineer"
  avatar={{ alt: 'John Doe' }}
  orientation="vertical"
/>

With Chip

Add a status indicator with chip. Pass true for default or an object to customize.

JD

John Doe

Online

JS

Jane Smith

Away

<script lang="ts">
  import { User } from 'sv5ui';
</script>

<!-- Simple online indicator -->
<User
  name="John Doe"
  description="Online"
  avatar={{ alt: 'John Doe' }}
  chip
/>

<!-- Custom chip -->
<User
  name="Jane Smith"
  description="Away"
  avatar={{ alt: 'Jane Smith' }}
  chip={{ color: 'warning' }}
/>

As Link

Provide href to render as a clickable link with hover state.

<script lang="ts">
  import { User } from 'sv5ui';
</script>

<User
  name="John Doe"
  description="View profile"
  avatar={{ alt: 'John Doe' }}
  href="/profile/john"
/>

UI Slots

Use the ui prop to override classes on internal elements.

SlotDescription
rootRoot container — controls flex layout, alignment, gap
wrapperText content wrapper — controls text alignment and overflow
nameName text element — controls font weight, size, color, truncation
descriptionDescription text element — controls font size, color, truncation
avatarAvatar wrapper — controls avatar sizing and shrink behavior

Snippets

Use snippets to customize specific parts of the User.

SnippetDescription
avatarSlotCustom avatar content — overrides avatar prop
nameSlotCustom name content — overrides name prop
descriptionSlotCustom description content — overrides description prop

Props

PropTypeDefault
namestring-
descriptionstring-
avatarAvatarProps-
chipboolean | ChipPropsfalse
size'3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl''md'
orientation'horizontal' | 'vertical''horizontal'
hrefstring-
askeyof HTMLElementTagNameMap'div'
refHTMLElement | nullnull
classstring-
uiRecord<Slot, Class>-