Skip to main content
Error: missing value for parameter 'doc' (index 0) (click for details)
Callstack:
    at xml.text()
    at (Template:0Template:OutSystems/OSCommunityHeader), /content/body/pre[1], line 52, column 29
    at template()
    at (Template:Custom/Views/Header), /content/body/pre[4], line 10, column 17
    at (Documentation/11/Developing_an_Application/Design_UI/Patterns/Using_Mobile_and_Reactive_Patterns/Content/User_Avatar), /content/body/div/div/div/ul/li/a/@rel

 

 

 

 
Language:
 
Applies only to Mobile Apps and Reactive Web Apps
Service Studio version:
 
 
OutSystems

User Avatar

Template:OutSystems/Documentation_KB/ContentCollaboration
  • Edit
    Collaborate with us
    Edit this page on GitHub
  • You can use the User Avatar UI Pattern to display a user's initials or their image in a circular badge.

    How to use the User Avatar UI Pattern

    The following example demonstrates how you can display the initials of the registered users on your platform.

    1. In Service Studio, in the Toolbox, search for User Avatar.

      The User Avatar widget is displayed.

      If the UI widget does not display, it may be because you used a ready-made app, which deletes unused widgets from the module. To make additional widgets available in your app:

      a. Go to Module > Manage dependencies.

      b. Search for and select the relevant Producer, for example OutSystemsUI. Ensure Show All is selected.

      c. On the Public elements for the selected Producer displayed on the right, ensure Show All is selected.

      d. Search for and select the element you want to add, and click Apply.

      e. In Service Studio, in the Toolbox, search for the widget again.

    2. From the Toolbox, drag the User Avatar widget into the Main Content area of your application's screen.

    3. To create an aggregate (in this example to retrieve all the users on the platform), right-click the screen name and select Fetch Data from Database.

    4. To add a database entity, click the screen, and from the Select Source pop-up, select the relevant entity and click OK. In this example, we select the User entity.

      The aggregate GetUsers is created.

    5. To reopen your screen, select the Interface tab, and double-click on your screen name.

    6. Select the User Avatar widget, and on the Properties tab, from the Name drop-down, select Expression Editor.

    7. In the Expression Editor, enter the following expression and click DONE.

      GetUsers.List.Current.User.Name

      Note: You can also add the expression by navigating through the Expression Editor's Scope tree and double-clicking on the Name output parameter.

      The Name property is now set to display the Name property of the aggregate you created earlier, which gets and displays the names of the registered users on your platform.

    8. On the Properties tab, you can also customize User Avatar's look and feel by setting any of the optional properties, for example, the color, shape, and size. The following example displays a blue, medium-sized, circle badge.

    After following these steps and publishing the module, you can test the pattern in your app.

    Properties

    Property Description
    Name (Text): Optional The initials that appear inside the user avatar. Set this to a data source that contains the value you want to display.

    Examples

    • Blank - Displays the initials JD (John Doe). This is the default.
    • VariableName - Displays the value that the variable "VariableName" holds at that time.
    • ExampleAggregate.Name - Displays the names contained in the records returned by the "ExampleAggregate" aggregate execution.
    Image (Binary Data): Optional The users image.
    Color (Color Identifier): Optional Set the badge's background color. Red, orange, yellow, lime, green, blue, violet, and pink are just some of predefined colors available for the badge.

    Examples

    • Blank - Displays the icon badge in the color you chose when creating the app. This is the default.
    • Entities.Color.Red - Displays a red icon badge.
    Size (Size Identifier): Optional Set the badge's size. Small and medium are the predefined sizes available for the badge.

    Examples

    • Blank - Displays a medium sized badge. This is the default value.
    • Entities.Size.Small - Displays a small sized badge.
    Shape (Shape Identifier): Optional Set the badge's shape. Rounded, soft rounded, and sharp are the predefined shapes available for the badge.

    Examples

    • Blank - Displays a rounded badge. This is the default value.
    • Entities.Shape.Sharp - displays a square badge
    IsLight (Boolean): Optional Specify the badge's background and text color.

    Examples

    • True - A brighter hue of the color is applied to the badge and a darker color to the text.
    • False - A darker hue of the color is applied to the badge and a lighter color to the text. This is the default.
    ExtendedClass (Text): Optional Adds custom style classes to the Pattern. You define your custom style classes in your application using CSS.

    Examples

    • Blank - No custom styles are added (default value).
    • "myclass" - Adds the myclass style to the UI styles being applied.
    • "myclass1 myclass2" - Adds the myclass1 and myclass2 styles to the UI styles being applied.
    You can also use the classes available on the OutSystems UI. For more information, see the OutSystems UI Live Style Guide.
    • Was this article helpful?