Get this Component on Github https://github.com/JodieM/Indicators

Bring some colour and visibility to the data on your Lightning Pages. Allow users to see at a glance what this record is about and what it's status is. This component is highly customisable and can be used in many record pages.

The icons are based off the standard Lightning Web Component Avatar.

This is my very first component so it may be a bit rough around the edges, and I welcome pull requests for suggestions on how to fix or improve it. But be kind, please.

Version 2 released! Now handles FALSE values!

Example Images

Default view after adding the component to the page
(except on Cases as the Case object does not have a Name field by default).

Suggested placement and usage.

Hover Text

Large Round Icons

Small Square Icons (no heading)

Strip - Small Round, no heading, no title, no icon

Long strip

Lot’s of Icons

A few too many?

Funky icons to tell a story (this one might be hard to make to be as flexible as it needs to be).
Icons from https://icons8.com

Serious business icons.
Icons from https://icons8.com

Using the Component

Rules

Tips

Examples

See Indicators Examples for a full list of examples of each type of Indicator that can be created.

Indicator Ideas

History of the idea of this component

Acknowledgements

Many members of the Salesforce community helped me with writing this Lightning Web Component. I hope I have not missed anyone:

And excellent blog posts or Stack Exchange articles from:

Here is my question on the Salesforce Stack Exchange to get to the bottom of one of the hardest parts of this code.

How this Component is Created

There is the Card component and the Avatar Component. Try it out in the Lightning Components Playground.

The design attributes take in all the setup values that are needed to display the card and each indicator. I would love these to be in an easier to edit format and potentially in CMDT in the future. Or maybe an advanced setup that is written in JSON (this idea has been mostly rejected though).

The setup checks to ensure that there is exactly the same number of settings in each field, and displays an error if there are any issues. (Thanks Clint for that code!).

The setup strips the semicolons from the field names and creates an array of field names. These are placed into an array with the Object Name (comes by default from placing the component on the page).

The Wire uses the Lightning uiRecordApi getRecord method to return the values from the fields listed in the array. This is how we can use getRecord without hard coding the field names. The optionalFields parameter is used so we do not display the indicator if the user does not have access to that field. (I could not get this working so it’s back to just using fields. Let me know if there is any issue with any errors arising from fields that users don’t have access to).

We use the uiRecordApi getFieldValue method to return the field value as that has the handy dandy feature of being able to traverse up the relationships. (Thanks Szandor for that idea!).

The Avatar component is conditionally rendered to only display if the field value is true (in Javascript that means a boolean true value OR text in a field).

So, a fully customisable, design attribute driven component that returns the fields that you chuck into an array, and displays them in pretty ways. I like it.