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 /meor a public profile read. remilianet-profile.css,profile-seal.svg,profile-barcode.js, andfonts/from the profile kit.
Steps
-
Serve
remilianet-profile.css,profile-seal.svg, and thefonts/directory from your app, side by side. -
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> -
Insert the display name and the handle as text.
-
Set
--rmn-profile-hueto the normalized numeric hue. -
Set the avatar source to
user.pfpUrl. -
Set the barcode source to
profileBarcodeUrl(handle)fromprofile-barcode.js. -
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> -
If the card links to the profile, replace the outer
divwith oneaelement.
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.
