User
<wa-user>
Displays an avatar with a user's identity and optional secondary details.
Examples
Secondary details
Use pseudonym and user-id for the built-in details.
Custom details
Default-slot content replaces the built-in pseudonym and user ID while preserving the name.
Copy user ID
Add with-copy to show the current Web Awesome copy button.
Avatar decorations
Use avatar-badge for a bottom decoration and avatar-indicator for a top decoration.
Avatar only
Use avatar-only when only the decorated avatar is needed. The name remains its accessible label.
Avatar images and shapes
image, shape, and loading follow the current avatar interface.
Overflow and alignment
Names and built-in details truncate when constrained. Use valid align-items values with --align.
Notes
- Override
--avatar-sizeto resize the avatar. --max-widthconstrains the entire component; it defaults to100%.fallback-namedefaults toDeleted userwhennameis empty.- Copy-button clicks do not bubble beyond the component, which keeps wrapping links and row actions from firing.
API
Importing
If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick a component manually, use one of the following snippets.
Import this component directly from the CDN:
import 'https://cdn.yoummday.com/packages/@yoummday/webawesome/0.5.1/dist/components/user/user.js';
After installing Web Awesome via npm, import this component:
import '@yoummday/webawesome/dist/components/user/user.js';
If you're self-hosting Web Awesome, import this component from your server:
import './webawesome/dist/components/user/user.js';
To import this component for React 18 or below, use the following code:
import WaUser from '@yoummday/webawesome/dist/react/user/index.js';
Slots
Learn more about using slots.
| Name | Description |
|---|---|
| (default) | Replaces the default pseudonym and user ID details while preserving the name. |
avatar-badge
|
Places a flag, badge, or other decoration at the avatar's bottom inline end. |
avatar-indicator
|
Places a status or rank indicator at the avatar's top inline end. |
Attributes & Properties
Learn more about attributes and properties.
| Name | Description | Reflects |
|---|---|---|
avatarOnlyavatar-only |
Hides the details and displays only the decorated avatar.
Type
boolean
Default
false
|
|
copyLabelcopy-label |
Accessible label and tooltip for the copy button.
Type
string
Default
''
|
|
fallbackNamefallback-name |
Text displayed when no name is available.
Type
string
Default
'Deleted user'
|
|
imageimage |
The avatar image URL.
Type
string
Default
''
|
|
initialsinitials |
Initials shown when no avatar image is available.
Type
string
Default
''
|
|
loadingloading |
Indicates how the browser should load the avatar image.
Type
'eager' | 'lazy'
Default
'lazy'
|
|
namename |
The user's display name.
Type
string
Default
''
|
|
pseudonympseudonym |
The user's pseudonym.
Type
string
Default
''
|
|
shapeshape |
The avatar's shape.
Type
'circle' | 'square' | 'rounded'
Default
'circle'
|
|
successLabelsuccess-label |
Feedback label shown after the user ID is copied.
Type
string
Default
''
|
|
userIduser-id |
The user's ID.
Type
string
Default
''
|
|
withCopywith-copy |
Shows a copy button beside the user ID.
Type
boolean
Default
false
|
CSS Custom Properties
Learn more about CSS custom properties.
| Name | Description |
|---|---|
--align |
The avatar and details' cross-axis alignment.
Default
center
|
--avatar-size |
The avatar's width and height.
Default
3rem
|
--max-width |
The component's maximum width.
Default
100%
|
CSS Parts
Learn more about CSS parts.
| Name | Description | CSS selector |
|---|---|---|
avatar |
The avatar component. |
::part(avatar)
|
avatar-wrapper |
The avatar and decoration container. |
::part(avatar-wrapper)
|
copy-button |
The user ID copy button. |
::part(copy-button)
|
info |
The text details container. |
::part(info)
|
name |
The display name. |
::part(name)
|
pseudonym |
The pseudonym. |
::part(pseudonym)
|
user |
The component's outer wrapper. |
::part(user)
|
user-id |
The user ID row. |
::part(user-id)
|
user-id-value |
The user ID text. |
::part(user-id-value)
|
base |
An alias for the component's outer wrapper. |
::part(base)
|
Dependencies
This component automatically imports the following elements. Sub-dependencies, if any exist, will also be included in this list.