User Profile Card
Display key information about your users
Use the UserProfileCard
component to showcase user identity with a banner, avatar, name, user handle, tags, and follower count. The make user data accessible and interactive in social, dashboard, or admin UIs.
<UserProfileCard avatar={{ img: '/img/avatar0.png', size: 50 }} name="Frank Miller" handle="@frank.miller" tags={['Astro', 'Svelte', 'React']} description="Contributor for <b>@Webcore</b>." editProfile={{ show: true, href: '#', label: 'Edit Profile ->' }} follow={{ followingCount: 7, followersCount: 1290 }}/>
The UserProfileCard
component consist of the following sections:
- Banner with CTA: A gradient banner with a CTA that you can customize using the
editProfile
prop that accepts the following properties:show
: Defaults tofalse
, you need to set this totrue
to show the button on the banner.label
: Sets the label on the button.href
: Sets the link for the button.target
: Sets the target of the link.
- Avatar: A user avatar that can be changed using the
avatar
prop. This object accepts properties in the form ofAvatarProps
- User info: User information is shown below the avatar and can be configured with the
name
,handle
,tags
, anddescription
props. - Followers: Follower count and text can be configured using the
follow
prop. Numbers are automatically formatted for improved readability.
You can use many different props to customize the appearance of your user profile cards. However, the only required prop for the component is called name
, in which case some default values will be rendered:
Customizing Banners
By default, the banner is displayed with gradient colors. You can customize these colors using the following CSS variables:
html body { --w-user-profile-card-start-color: #1CAED7; --w-user-profile-card-end-color: #4E00C2;}
This will set the default gradient colors for all UserProfileCard
components. The colors can also be set on individual cards using the banner.fromColor
and banner.toColor
props:
<UserProfileCard ... banner={{ fromColor: 'var(--w-color-success)', toColor: 'var(--w-color-info)' }}/>
You can also display images inside the banner by specifying a src
attribute instead. (You can provide alt
, width
, height
and lazy
attributes to the banner
prop to customize the way your banner image is rendered):
<UserProfileCard ... banner={{ src: '/path/to/img.png' }}/>
Configuring Followers
The follower count is automatically displayed when using the component. This section can be toggled off by setting the follow.showFollowing
and follow.showFollowers
props to false
. You can also configure the text to translate them with the follow.followingText
and follow.followersText
props:
<UserProfileCard ... follow={{ showFollowing: false, showFollowers: false }}/>
<UserProfileCard ... follow={{ followingCount: 7, followersCount: 1290, followingText: 'Subscriptions', followersText: 'Subscribers' }}/>
Showing Additional Content
To show additional content inside your user profile card, simply pass your elements as the children to the component. For example, you can display reviews inside the card in the following way to create rich user-rating cards:
<UserProfileCard ...> <Review element="div" compact={true} review={{ name: 'Most helpful review:', date: 'Last reviewed: 2025. 02. 15.', description: 'Absolutely fantastic creator! The quality exceeded my expectations, and the customer support was super helpful. Highly recommend!', rating: { score: 5, color: 'var(--w-color-warning)' } }} verifiedText="Verified User" /></UserProfileCard>
Reviews
block to learn more about how you can use it within your apps. API
type UserProfileCardProps = { avatar?: AvatarProps editProfile?: { show?: boolean label?: string href: string target?: | '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop' } banner?: { src?: string alt?: string width?: number height?: number lazy?: boolean fromColor?: string toColor?: string } name: string handle?: string tags?: string[] description?: string follow?: { showFollowing?: boolean showFollowers?: boolean followingCount?: number followersCount?: number followingText?: string followersText?: string } className?: string}
Avatar
component for AvatarProps
. Prop | Default | Purpose |
---|---|---|
avatar | user.svg | Sets an avatar for the card. |
editProfile | - | Specifies a CTA at the top-right corner. |
editProfile.show | false | Set to true to make the "Edit Profile" button visible. |
editProfile.label | "Edit Profile" | Sets a label for the button. |
editProfile.href | - | Sets a link for the "Edit Profile" button. |
editProfile.target | - | Sets the target of the link on the "Edit Profile" button. |
banner | - | Sets a banner image above the avatar. |
banner.src | - | Sets the path for the banner. |
banner.alt | - | Sets an alternate text for the banner. |
banner.width | - | Sets the width of the banner. |
banner.height | - | Sets the height of the banner. |
banner.lazy | - | Set to true to enable lazy loading for the banner. |
banner.fromColor | #1CAED7 | Sets the starting color for the banner gradient when no image is provided. |
banner.toColor | #4E00C2 | Sets the ending color for the banner gradient. |
name | - | Sets the name of the user. |
handle | - | Sets a handle under the name of the user. |
tags | [] | Pass an array of strings to set badges as tags under the handle. |
description | - | Sets a description under the tags. |
follow.showFollowing | true | Shows following count. |
follow.showFollowers | true | Shows followers count. |
follow.followingCount | 0 | Sets the number of following. |
follow.followersCount | 0 | Sets the number of followers. |
follow.followingText | Following | Sets the following text. |
follow.followersText | Followers | Sets the followers text. |
className | - | Pass additional CSS classes for the component. |