Skip to content

UI kits and design

Add a profile card

Add the profile menu card or the compact identity badge to an account menu with the profile kit stylesheet.

The profile menu card matches the MiniProfile card in the navigation bar of the live site. The card fills its container and grows when its name wraps. For the field rules, see Remilia profiles in your app.

Prerequisites

  • The profile response of the account, from GET /me or a public profile read.
  • remilianet-profile.css, profile-seal.svg, profile-barcode.js, and fonts/ from the profile kit.

Steps

  1. Serve remilianet-profile.css, profile-seal.svg, and the fonts/ directory from your app, side by side.

  2. Add the card markup to the account menu:

    <div class="rmn-account rmn-account--menu" style="--rmn-profile-hue:47">
      <img class="rmn-account__avatar" src="YOUR_PROFILE_PICTURE_URL" alt="">
      <div class="rmn-account__labels">
        <span class="rmn-account__name">Remilia Jackson</span>
        <span class="rmn-account__handle">~remilia_jackson</span>
      </div>
      <img class="rmn-account__barcode" src="YOUR_USER_BARCODE_URL" alt=""
           aria-hidden="true">
    </div>
  3. Insert the display name and the handle as text.

  4. Set --rmn-profile-hue to the normalized numeric hue.

  5. Set the avatar source to user.pfpUrl.

  6. Set the barcode source to profileBarcodeUrl(handle) from profile-barcode.js.

  7. If the avatar fails to load, replace the image with the fallback element:

    <span class="rmn-account__avatar rmn-account__avatar--fallback"
          aria-hidden="true">RJ</span>
  8. If the card links to the profile, replace the outer div with one a element.

Result

The account menu shows the card with the name, the handle, the profile picture, the profile hue, and the barcode. A card that links to the profile is one keyboard target, and the visible name is its accessible label.

The barcode encodes USR, the uppercase handle without non-alphanumeric characters, and ID, in Code 128, as on the live site. The barcode is decorative, not a credential or a proof of permission. profile-barcode.svg is only the sample for Remilia Jackson.

Add the compact identity badge

The compact identity badge suits a smaller space, such as a permission popout. It uses the same field mapping without the seal and the barcode:

<link rel="stylesheet" href="/assets/remilianet-profile/remilianet-profile.css">
<div class="rmn-account" style="--rmn-profile-hue:47">
  <img class="rmn-account__avatar" src="YOUR_PROFILE_PICTURE_URL" alt="">
  <div class="rmn-account__labels">
    <span class="rmn-account__name">Remilia Jackson</span>
    <span class="rmn-account__handle">~remilia_jackson</span>
  </div>
</div>

--rmn-profile-font replaces Remilia-Mono with a font your app already loads. A badge that opens account settings is a button with a name that describes that action. Touch targets stay at least 44 px, even when the visible avatar is smaller.