lightning__UtilityBar Target

Enables a component to be used as a utility item in an app's utility bar.

Syntax 

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
  <apiVersion>58.0</apiVersion>
  <isExposed>true</isExposed>
  <targets>
    <target>lightning__UtilityBar</target>
  </targets>
  <targetConfigs>
    <targetConfig targets="lightning__UtilityBar">
      <property name="greeting" type="String" description="Enter a greeting"/>
    </targetConfig>
  </targetConfigs>
</LightningComponentBundle>

targetConfigs 

Configures the component and defines component properties. The targetConfigs tag contains at least one targetConfig tag.

targetConfig 

Configures a page type with this attribute.

AttributeDescriptionRequired
targetsSpecify one or more page types in the targets attribute, such as <targetConfig targets="lightning__UtilityBar"> or <targetConfig targets="lightning__UtilityBar,lightning__AppPage">. The targets attribute value must match one or more of the page types that you listed under <targets>.Yes

The targetConfig tag includes at least one property tag.

property 

Specifies a public property of a component that can be set in App Manager. The component author defines the property in the component’s JavaScript class using the @api decorator. See the Usage section.

Use the property tag with these attributes.

AttributeTypeDescriptionRequired
nameStringThe attribute name. This value must match the property name in the component’s JavaScript class.Yes
typeStringThe attribute's data type. The following values are valid for all targets. Make sure that this value matches the type assigned to the property in the component's JavaScript module. If the types don't match, the value in the configuration file takes precedence.
  • Boolean
  • Integer
  • String
Yes
datasourceStringRenders a field as a picklist, with static values. Supported only if the type attribute is String. For example: datasource="value1,value2,value3". You can also set the picklist values dynamically using an Apex class, such as: datasource="apex://MyCustomPickList". For more information, see Create Dynamic Picklists for Your Custom Components.
defaultStringThe default value for the attribute.
descriptionStringDisplays as an i-bubble for the attribute in Lightning App Builder.
labelStringDisplays as a label for the attribute in Lightning App Builder.
maxIntegerThe maximum allowed value for an attribute of type Integer.
minIntegerThe minimum allowed value for an attribute of type Integer.
placeholderStringInput placeholder text for the attribute when it displays in Lightning App Builder. This text is the ghost text in text fields and text areas before a user starts typing. Supported only if the type attribute is String.
requiredBooleanSpecifies whether the attribute is required. The default value is false.

Usage 

To expose a component property, define the property in the component’s JavaScript class using the @api decorator. You can also update the property value in the App Manager page.

import { LightningElement, api } from "lwc";

export default class UtilityBarExample extends LightningElement {
  @api greeting;
}
<template>
  <lightning-card
    title="UtilityBarAPIComponent"
    icon-name="standard:scheduling_workspace"
  >
    {greeting}
  </lightning-card>
</template>

See Also

Release Preview

This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.