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 for a simple user display.

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, each scaling avatar and text proportionally.

3xs
J
Jane
Designer
2xs
J
Jane
Designer
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

Use the chip prop to add a status indicator on the avatar. Pass true for default or an object for custom styling.

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 an href prop to render the User as a clickable link.

<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 specific internal elements of the User.

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 Svelte 5 snippets to customize specific parts of the User.

SnippetTypeDescription
avatarSlotSnippetCustom avatar content — overrides avatar prop
nameSlotSnippetCustom name content — overrides name prop
descriptionSlotSnippetCustom description content — overrides description prop

Props

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