BridgeBeta
  • Brand
  • Digital Assets
    Foundations
    Icons
    Components
    Templates
  • Resources
    Design Tokens
    How-tos
    Best Practices
    Libraries
    Accessibility
    Products List
  • Support
    • Overview
    • Actions
      • Overview
      • Button
      • ContextMenu
      • Link
    • Controls
      • Overview
      • Checkbox
      • Tag
      • Toggle
    • Forms
      • Overview
      • DatePicker
      • FileUploader
      • Input
      • NumberInput
      • RadioButton
      • Search
      • Select
      • Slider
      • TextArea
      • TextInput
    • Hooks
      • useIsomorphicLayoutEffect
      • useMediaQuery
      • useSettings
    • Navigation
      • Overview
      • AnchorNavigation
      • BannerNavigation
      • Breadcrumb
      • Footer
      • InfoBar
      • MainNavigation
      • SecondaryNavigation
      • StepNavigation
      • SubNavigation
    • Overlay
      • Overview
      • Credits
      • Modal
      • ModalWrapper
      • Notification
      • Tooltip
    • Structure
      • Overview
      • Accordion
      • AuthLayout
      • Avatar
      • Callout
      • Card
      • ContentSwitcher
      • Empty
      • Hero
      • InlineLoading
      • Item
      • List
      • Loading
      • mdxComponents
      • Module
      • Pagination
      • ReadMore
      • Story
      • Table
      • Tabs
      • Text
      • Unit
      • User
      • WFPCoreProvider
      • Wrapper
Components
Structure
User

User

  • Design
  • Code
  • Props

Import statement

import { User } from "@wfp/react"

The User component extends the functionality of the Avatar component by incorporating user-related information such as name and descriptions. This component is commonly used in main navigation and forms.

Usage

Editable Example

<User
  image="https://www.wfp.org/sites/default/files/styles/page_accordion/public/images/ourwork_humanitarian.jpg?itok=R0ymBwxH"
  name="John Doe"
  alt="John Doe’s Avatar"
  showName
/>;

Component behaviour

  • Avatar Display: Utilizes the Avatar component to display the user’s image or a fallback icon.
  • Name and Descriptions: Optionally displays the user’s name, a brief description, and an extended description based on props.
  • Customizable Appearance: Supports custom styling and component replacement through className and components props.

Accessibility

  • The alt prop is crucial for screen reader accessibility, providing a text alternative for the avatar image.

Example

User with Initials

Editable Example

<User
  alt="Jane Doe’s avatar"
  name="Jane Doe"
  showName
  missingImage="letter"
/>;

User with extended description

Editable Example

<User
  image="https://www.wfp.org/sites/default/files/styles/page_accordion/public/images/ourwork_humanitarian.jpg?itok=R0ymBwxH"
  alt="Jane Doe’s avatar"
  name="Jane Doe"
  ellipsis
  description={<p>Project Manager</p>}
  extendedDescription={
    <p>Additional details about Jane Doe</p>
  }
  showName
/>;

In this example, the User component displays an avatar with the image from the provided URL. If the URL is unavailable, the component defaults to the specified missing image mode. The user’s name, "Jane Doe," is displayed with an ellipsis for long names. Below the name, a brief description and an extended description provide additional information about the user.

Related

  • Avatar

On this page

  • Usage
  • Component behaviour
  • Accessibility
  • Example
  • User with Initials
  • User with extended description
  • Related

References

  • Storybook
Storybook
Figma library
Contact us
2025 © World Food Programme