Salesforce

Add a custom icon to the SDK app bar

« Go Back
Information
Add a custom icon to the SDK app bar
000004576
Public
Product Selection
aiWare - aiWare
Article Details

Custom icons can reinforce an application's brand identity, and improve the user experience by making it easier for users to find the features they need quickly.

To add custom icons to the aiWARE SDK's app-bar component, you need to use the app bar's rightActions property.

Steps

  1. If the app bar widget isn't mounted, mount it using aiware.mountWidget().
  2. In the rightActions property, add an object to the array. Each object in the array represents an icon on the app bar. The object should use the label and onClick properties, and you can set the isActive property to determine if the icon is initially active or inactive. This sample code adds a bell icon that logs Fired! to the console when it's clicked.
        aiware.mountWidget({
            name: 'APP_BAR',
            config: {
                rightActions: [{
                    label: `
            <span class="notification-btn">
            <img src="https://img.icons8.com/office/24/000000/appointment-reminders--v1.png"/>
            <span class="notification-badge">3</span>
            </span>
        `,
                    onClick: function(event) {
                        console.log("Fired!")
                    }
                }]
            }
        })

    This sample code styles the bell icon added by the JavaScript code above.

        .notification-btn {
        position: relative;
        display: block
        }
        .notification-btn .notification-badge {
        position: absolute;
        top: -10px;
        right: -5px;
        line-height: 20px;
        padding: 0 6px;
        background: red;
        display: flex;
        color: white;
        border-radius: 50%;
        }

 

Additional Technical Documentation Information
Properties
2/12/2024 7:29 PM
2/12/2024 9:40 PM
2/12/2024 9:40 PM
Documentation
Documentation
000004576
Translation Information
English

Powered by