` container within `lightning-record-view-form`.
When using `lightning-output-field`, the field label for certain fields can differ from those displayed on a standard record page. For example, the `Name` field on the opportunity object displays "Name" instead of "Opportunity Name" while the `Name` field on the account object displays "Account Name".
This component has usage differences from its Aura counterpart. See [Base Components: Aura Vs Lightning Web Components](https://developer.salesforce.com/docs/platform/lwc/guide/migrate-map-aura-lwc-components) in the Lightning Web Components Developer Guide.
:::::
:::::tab
::component-specification{component="outputField" model="lwc" namespace="lightning"}
:::::
::::::
# Page Change
**`wave:pageChange`**
Updates the Analytics dashboard with the specified `pageid`.
**For Use In**
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App
::::::tabset{tabs='[ "Develop", "Specifications"]'}
:::::tab
The `wave:pageChange` event updates the Analytics dashboard with the specified `pageid`.
For more information, see the [Analytics Web SDK Dev Guide](https://developer.salesforce.com/docs/atlas.en-us.bi_dev_guide_sdk.meta/bi_dev_guide_sdk/bi_sdk_web.htm).
:::::
:::::tab
## Attributes
| Name | Description | Type | Default | Required |
| --------- | ----------------------------------------------------------------- | ------ | ------- | -------------------------------------------- |
| `devName` | The fully qualified dev name for the Analytics dashboard. | string | |  |
| `pageid` | The dashboard page that should be displayed if value is supplied. | string | |  |
:::::
::::::
# Page Reference Utils
**`lightning/pageReferenceUtils`**
Provides utilities for encoding and decoding default field values. This component requires API version 48.0 or later.
**For Use In**
Lightning Experience
::::::tabset{tabs='[ "Develop", "Specifications"]'}
:::::tab
The `lightning/pageReferenceUtils` module provides utilities for encoding and decoding default field values. Pass this string into the `pageReference.state.defaultFieldValues` attribute on `standard__objectPage` page reference types. This module is not supported in Lightning Out, Experience Builder sites, or the Salesforce mobile app.
In a module's Javascript file, import `encodeDefaultFieldValues()` or `decodeDefaultFieldValues()` from `lightning/pageReferenceUtils` using this syntax.
```javascript
import { encodeDefaultFieldValues } from "lightning/pageReferenceUtils";
```
## `encodeDefaultFieldValues`
Encodes default field values from a JavaScript object into a serialized string.
| Parameter | Type | Description |
| ------------------ | ------ | ----------------------------------------------------------------------------- |
| defaultFieldValues | object | List of default key-value pairs for the default field values you are passing. |
## `decodeDefaultFieldValues`
Decodes default field values from a serialized string into a standard object. Use this method when overriding a standard action only.
| Parameter | Type | Description |
| ------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------- |
| encodedDefaultFieldValuesString | string | Encoded string of default field values. The values returned by this method are strings. Field type isn't preserved. |
## Usage
The key-value pairs of an object are encoded into a serialized string that you pass into the `pageReference.state.defaultFieldValues` property.
These objects are not supported by `lightning/pageReferenceUtils`:
- ContractLineItem
- OpportunityLineItem
- OrderItem
- QuoteLineItem
- WorkOrderLineItem
Passing the `recordTypeId` to `defaultFieldValues` is not yet supported. The `recordTypeId` influences routing behavior, layout assignment, and page assignment, so you can see unexpected results if you try to use it.
You can specify values for fields even if they’re not available in the create record form.
- If the field is hidden because it’s not on the page layout, the value specified in `defaultFieldValues` is saved with the new record.
- If the current user doesn’t have create access to the field, due to field-level security, attempts to save the new record result in an error.
Error messages can’t reference fields that the current user doesn’t have access to. This constraint means the user won’t know why the error occurred or how to resolve the issue. It’s essential to perform access checks in your own code before firing the event.
You can’t prepopulate system-maintained fields, such as Id or record modification time stamps. Default values for these fields are silently ignored.
Prepopulating rich text fields is unsupported.
Date and time field values must use the ISO 8601 format. For example:
- Date: 2017-07-18
- Datetime: 2017-07-18T03:00:00Z
While the create record page presents `datetime` values in the user’s local time, you must convert `datetime` values to UTC to prepopulate the field.
## LWC Recipes
The [LWC Recipes GitHub repository](https://github.com/trailheadapps/lwc-recipes) contains code examples for Lightning Web Components that you can test in an org.
For a recipe that uses `lightning/pageReferenceUtils`, see the `c-nav-to-new-record-with-defaults` component.
## See Also
- [Navigate to a Record Create Page with Default Field Values](https://developer.salesforce.com/docs/platform/lwc/guide/use-navigate-default)
:::::
:::::tab
::component-specification{component="pageReferenceUtils" model="lwc" namespace="lightning"}
:::::
::::::
# Pill
**`lightning-pill`**
A pill displays a label that can contain links and can be removed from view.
**For Use In**
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline
::::::tabset{tabs='["Example", "Develop", "Specifications"]'}
:::::tab
::component-playground{component="pill" model="lwc" namespace="lightning"}
:::::
:::::tab
A `lightning-pill` component represents an item, such as an account name or
case number. By default, pills include a remove button. They’re useful for read-only text that you can add or remove on demand. for example, you can add or remove an item from a list of email addresses or a list of keywords.
This example creates a basic pill with a link.
```html
```
URLs without a protocol use the host domain's protocol. For example, `www.example.com` is prefixed with `https://` if the host domain's protocol is `https://`.
## Design
`lightning-pill` implements the pills blueprint in the Salesforce Lightning Design System (SLDS). The pills adapt to SLDS 1 or SLDS 2 styling based on the org's theme or the container app that you use.
| | SLDS 1 | SLDS 2 |
| :------------- | :------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------- |
| **Design** | [Pills](https://v1.lightningdesignsystem.com/components/pills/) | [Pills](https://www.lightningdesignsystem.com/components/pills/) |
| **For Use In** | Lightning Experience, Experience Builder sites, Salesforce mobile app, Lightning Out (Beta), Standalone Lightning app, Mobile Offline | [Lightning Experience](https://help.salesforce.com/s/articleView?id=xcloud.customize_ui_enhancedlex.htm&type=5) |
## Insert an Icon or Avatar
A pill can contain an icon or avatar to represent the type of object. Nest a `lightning-icon` or `lightning-avatar` component inside the `lightning-pill` component.
Insert an icon on the pill using `lightning-icon`. For more information, see [lightning-icon](/docs/platform/lightning-component-reference/guide/lightning-icon.html).
```html
```
Insert an avatar on the pill by using `lightning-avatar`. For more information, see [lightning-avatar](/docs/platform/lightning-component-reference/guide/lightning-avatar.html).
```html
```
## Interact with Pills
A pill has three clickable elements.
- The optional icon or avatar
- The text label
- The remove button
All three elements trigger the `onclick` handler when clicked. If you provide an `href` value, clicking the text label triggers the `onclick` handler and then takes you to the provided path.
Clicking the remove button on the pill fires the `remove` event and then the `click` event. Use the optional `onremove` and `onclick` handlers to remove the pill and perform an action. You must hide or remove the pill on your own using the `onremove` handler, as shown in the next example. If you don't specify a pill removal behavior, clicking the remove button doesn't have a visible effect.
When an `href` value is present, clicking the text label navigates to a link, but clicking the icon or avatar doesn’t. To prevent your browser from navigating to a link when you click a pill's label, call `event.preventDefault()` in the `onclick` handler.
When an `href` value is present, the default variant is `link`. If no `href` is present, the default variant is `plain`.
To disable a pill's link, set `variant="plain"`, which removes the anchor element. The `plain` variant renders the pill without a link and ignores the `href` attribute.
This example hides a pill when you click its remove button.
```html
```
To prevent navigating to the link when the remove button is clicked, call `event.preventDefault()` in the `onremove` handler. The `click` event is still fired when you click the text label. However, calling `event.preventDefault()` in the `onremove` handler prevents the `click` event from firing when you click the remove button.
```javascript
import { LightningElement } from "lwc";
export default class PillRemoveExample extends LightningElement {
showPill = true;
handleRemoveOnly(event) {
event.preventDefault();
this.showPill = !this.showPill;
}
handleClick(event) {
// this won't run when you click the remove button
alert("The pill was clicked!");
}
}
```
## Display an Error
Display a pill in an error state when the containing text doesn't match a
pre-defined collection of items, such as when an email address is invalid or a
case number doesn't exist.
Use the `has-error` attribute to denote an error on a pill. This attribute inserts an error icon next to the label and changes the label text to red. Providing an icon or avatar in this context has no effect on the pill; the error icon is still displayed.
```html
```
## Component Styling
Use a combination of variants and utility classes to customize your pills.
### Variants
Specify the `variant` attribute using one of these values.
- `link` is the default pill variant, which creates a link in the pill when you specify the `href` value
- `plain` renders the pill without a link and ignores the `href` value
When using a [`lightning-avatar`](/docs/platform/lightning-component-reference/guide/lightning-avatar.html) or [`lightning-icon`](/docs/platform/lightning-component-reference/guide/lightning-icon.html) with the pill, consider the variants on those components.
### Utility Classes
To apply additional styling, use the SLDS [utility classes](https://v1.lightningdesignsystem.com/utilities/alignment) with the `class` attribute.
This example adds padding on the left of the second pill using an SLDS class.
```html
```
### Styling Hooks
Component styling hooks provide CSS custom properties that use the `--slds-c-*` prefix and they change styling for specific elements or properties of a component. Component styling hooks are supported for SLDS 1 only. See the [SLDS 1 component blueprints](https://v1.lightningdesignsystem.com/components/overview/) for available component styling hooks.
For more information, see [Style Components Using Lightning Design System Styling Hooks](https://developer.salesforce.com/docs/platform/lwc/guide/create-components-css-custom-properties) in the Lightning Web Components Developer Guide.
## Usage Considerations
Icons are not available in Lightning Out, but they're available in Lightning Components for Visualforce and other experiences.
To create more than one pill, use the `lightning-pill-container` component, which gives you access to the pill array via the `itemremove` event.
Specifying a target to change where the link should open is not supported. The link opens on the same tab or window. To create a URL that navigates to another page in Salesforce, use
[`lightning-navigation`](/docs/platform/lightning-component-reference/guide/lightning-navigation.html).
This component has usage differences from its Aura counterpart. See [Base Components: Aura Vs Lightning Web Components](https://developer.salesforce.com/docs/platform/lwc/guide/migrate-map-aura-lwc-components) in the Lightning Web Components Developer Guide.
## Accessibility
When using `lightning-avatar`, use the `alternative-text` attribute to describe the avatar, such as a user's initials or name. This description provides the value for the `alt` attribute in the `img` HTML tag.
When using `lightning-icon`, use the `alternative-text` attribute to describe the icon. For example, specify "Account" instead of "Pill icon". This description is used as assistive text on the pill.
Press the Tab key to move focus to a pill with a link, and tab again to move focus to the remove button. To remove a pill, press the Enter key or space bar when the focus is on the remove button. You can define your own behavior to remove the pill from view, such as using the `onremove` handler shown in **Interacting with Pills**. To navigate to the target of a link on a pill, press the Enter key when the focus is on the pill.
If a pill doesn't have a link, the only focusable item is the remove button.
## Custom Events
**`remove`**
The first event fired when you click the remove button.
The `remove` event returns the following parameter.
| Parameter | Type | Description |
| --------- | ------ | ------------------------------------ |
| name | string | The name of the pill that's removed. |
The event properties are as follows.
| Property | Value | Description |
| ---------- | ----- | ------------------------------------------------------------------------------------------------------------------------ |
| bubbles | false | This event does not bubble. |
| cancelable | true | This event can be canceled. You can call `preventDefault()` on this event to prevent the `click` event from being fired. |
| composed | false | This event does not propagate outside the template in which it was dispatched. |
:::::
:::::tab
::component-specification{component="pill" model="lwc" namespace="lightning"}
:::::
::::::
# Pill Container
**`lightning-pill-container`**
A list of pills grouped in a container. This component requires API version 42.0 and later.
**For Use In**
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline
::::::tabset{tabs='["Example", "Develop", "Specifications"]'}
:::::tab
::component-playground{component="pillContainer" model="lwc" namespace="lightning"}
:::::
:::::tab
A `lightning-pill-container` component represents a list of pills in a container
that resembles an input field. Use `lightning-pill-container` to indicate a user's selections when filtering a list, such as from a multi-select picklist.
`lightning-pill-container` includes pills by using the `lightning-pill` component, which can append an icon or avatar next to the text label.
To specify the pills, set the `items` attribute to an array of values in your component's JavaScript.
By default, all pills in the container wrap to additional lines if they can't fit on one line.
For information about changing the behavior, see [Manage Pill Layout in the Container](#manage-pill-layout-in-the-container).
This example creates three pills: a text-only pill, a pill with a link and an avatar, and a pill with an icon.
```html
```
```javascript
import { LightningElement } from "lwc";
export default class PillContainerExample extends LightningElement {
items = [
{
label: "My Pill",
name: "mypill",
},
{
type: "avatar",
label: "Avatar Pill",
href: "https://www.example.com",
name: "avatarpill",
src: "/my/path/avatar.jpg",
fallbackIconName: "standard:user",
variant: "circle",
alternativeText: "User avatar",
},
{
type: "icon",
label: "Icon Pill",
name: "iconpill",
iconName: "standard:account",
alternativeText: "Account",
},
];
}
```
## Design
`lightning-pill-container` implements several designs in the Salesforce Lightning Design System (SLDS). The designs adapt to SLDS 1 or SLDS 2 styling based on the org's theme or the container app that you use.
| | SLDS 1 | SLDS 2 |
| :------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------- |
| **Design** (`base` variant) | [Pills with Container](https://v1.lightningdesignsystem.com/components/pills/#Pill-with-Container) | [Pills with Container](https://www.lightningdesignsystem.com/components/pills/#Pill-with-Container) |
| **Design** (`standard` variant) | [Listbox of Pill Options](https://v1.lightningdesignsystem.com/components/pills/#Listbox-Of-Pill-Options) | [Listbox of Pill Options](https://www.lightningdesignsystem.com/components/pills/#Listbox-Of-Pill-Options) |
| **For Use In** | Lightning Experience, Experience Builder sites, Salesforce mobile app, Lightning Out (Beta), Standalone Lightning app, Mobile Offline | [Lightning Experience](https://help.salesforce.com/s/articleView?id=xcloud.customize_ui_enhancedlex.htm&type=5) |
## Usage
A text-only pill supports several attributes. Use these attributes to create a pill with an avatar or icon.
- `label`: Required. The text label in the pill.
- `name`: The name for the pill. This value is optional and can be used to identify the pill in a callback.
To create a pill with a link, use the following attribute.
- `href`: Required. The URL for the link.
To create a pill with an avatar, use the following attributes.
- `type`: The media type. Use `avatar`.
- `src`: Required. The URL of the avatar.
- `fallbackIconName`: The Lightning Design System name of the icon to use as a fallback when the image fails to load. Names follow the format 'standard:account' where 'standard' is the category, and 'account' is the specific icon to include. Only icons from the standard and custom categories are allowed.
- `variant`: Changes the shape of the avatar. Valid values are empty, circle, and square. This value defaults to square.
- `alternativeText`: The alternative text used to describe the avatar, which appears as hover text on the image.
To create a pill with an icon, use these attributes.
- `type`: The media type. Use `icon`.
- `iconName`: Required. The Lightning Design System name of the icon. Names are written in the format 'utility:down' where 'utility' is the category, and 'down' is the specific icon to include. Supports utility icons only.
- `alternativeText`: The alternative text used to describe the icon. Describe what happens when you click the button, for example 'Upload File', not what the icon looks like, 'Paperclip'.
`lightning-pill-container` provides two variants: `bare` and `standard` (default). They’re visually the same. However, the `standard` variant renders pills in an unordered list element. For more information, see the [Accessibility](#accessibility) section.
## Remove Pills
Clicking the remove button triggers the `onitemremove` handler.
```html
```
You can retrieve the name of the pill that's clicked in the event handler and
remove the pill from view.
```javascript
import { LightningElement, track } from "lwc";
export default class PillContainerRemoveExample extends LightningElement {
@track items = [
{
label: "My Pill",
name: "mypill",
},
{
type: "avatar",
label: "Avatar Pill",
name: "avatarpill",
src: "/my/path/avatar.jpg",
fallbackIconName: "standard:user",
variant: "circle",
alternativeText: "User avatar",
},
{
type: "icon",
label: "Icon Pill",
name: "iconpill",
iconName: "standard:account",
alternativeText: "Account",
},
];
handleItemRemove(event) {
const name = event.detail.item.name;
alert(name + " pill was removed!");
const index = event.detail.index;
this.items.splice(index, 1);
}
}
```
## Manage Pill Layout in the Container
Several boolean attributes control the layout of pills in the container. These attributes are set to false by default, which makes pills wrap to multiple lines.
- `is-collapsible`: Determines whether the list of pills can be expanded and collapsed. If `is-collapsible` is true, `is-expanded` can determine whether a pill list displays all the pills or one line of pills. If `is-collapsible` is false or not specified, the `is-expanded` attribute has no effect regardless of its value.
- `is-expanded`: Determines whether the full list of pills is shown. Set `is-collapsible` to true if you want to set `is-expanded` to expand and collapse the list. If you set `is-expanded` to false and don't set `is-collapsible` to true, the list is expanded.
- `single-line`: Specifies that the pill container can display one line of pills. By default, if pills can't fit on one line, they’re wrapped to additional lines to fit the container. Set `single-line` to true to limit pill display to one line. This attribute overrides `is-collapsible` and `is-expanded`.
If all pills aren't displayed, the component shows a text button indicating how many more pills there are.
For example, if there are five more pills that aren’t displayed, the text button shows `+5 more`. The text button fires the `focus` event when you click it.
To display a long list of pills as collapsed, set `is-collapsible` to true and optionally set `is-expanded` to false. Otherwise, pills are expanded by default.
### Expand and Collapse Pills Programmatically
Use `is-collapsible` and `is-expanded` to programmatically expand and collapse the pills.
This example sets `is-collapsible` and uses a button to change the value of `is-expanded`.
```html
```
The list of pills is initially collapsed. The button expands and collapses the list.
```javascript
import { LightningElement } from "lwc";
export default class PillContainerCanCollapse extends LightningElement {
isExpanded = false;
setExpanded(event) {
this.isExpanded = !this.isExpanded;
}
items = [
{
//define the pills
},
];
}
```
### Display All Pills With the `+n more` Button
If all pills aren't displayed, the component shows a text button labeled `+n more` to indicate more pills can be displayed. By default, `lightning-pill-container` doesn’t handle the `focus` event that’s fired when you click the button. You can handle the event to display more pills or write logic to do something else when the button is clicked.
This example sets the pills to be collapsible but not expanded and handles the focus event.
```html
```
The list of pills is initially collapsed. When there are too many pills to show, the text button labeled `+n more` displays. The handler for the `focus` event enables all the pills to display.
```javascript
import { LightningElement } from "lwc";
export default class PillContainerMoreButtonExpands extends LightningElement {
collapsible = true;
expanded = false;
handlePillExpansion() {
this.expanded = true;
}
items = [
{
//define the pills
},
];
}
```
## Component Styling
Use a combination of variants and utility classes to customize your pills.
### Variants
When using a [`lightning-avatar`](/docs/platform/lightning-component-reference/guide/lightning-avatar.html) or [`lightning-icon`](/docs/platform/lightning-component-reference/guide/lightning-icon.html) with the pill, consider the variants on those components.
### Utility Classes
To apply additional styling, use the SLDS [utility classes](https://v1.lightningdesignsystem.com/utilities/alignment) with the `class` attribute.
### Styling Hooks
Component styling hooks provide CSS custom properties that use the `--slds-c-*` prefix and they change styling for specific elements or properties of a component. Component styling hooks are supported for SLDS 1 only. See the [SLDS 1 component blueprints](https://v1.lightningdesignsystem.com/components/overview/) for available component styling hooks.
For more information, see [Style Components Using Lightning Design System Styling Hooks](https://developer.salesforce.com/docs/platform/lwc/guide/create-components-css-custom-properties) in the Lightning Web Components Developer Guide.
`lightning-pill-container` renders pills using `lightning-pill`. Use the `--slds-c-pill-*` custom properties on `lightning-pill`. CSS custom properties for pill containers work only with particular `lightning-pill-container` variants for the remove button.
| CSS Custom Property | `lightning-pill-container` Variants |
| ---------------------------------------- | ----------------------------------- |
| `--slds-c-icon-color-background` | `standard` (default) |
| `--slds-c-icon-color-foreground-default` | `standard` (default) |
| `--slds-c-button-color-background` | `bare` |
| `--slds-c-button-color-border` | `bare` |
| `--slds-c-button-radius-border` | `bare` |
| `--slds-c-button-sizing-border` | `bare` |
## Accessibility
By default, `lightning-pill-container` renders pills using the `standard` variant, which uses an unordered list element to display pills. Press the Tab key to focus on the first pill and use the Left Arrow and Right Arrow keys to navigate through the pills. Use the Tab key to navigate to the remove button in a pill with a link. Use arrow keys to navigate between pills.
The focus goes to a link if present, otherwise focus goes to the remove button.
The `bare` variant only supports the Tab key for navigating between focusable elements in the container's pills. The arrow keys aren't supported.
On mobile devices, both container variants display pills with the close button as a focusable element for accessibility.
To remove a pill, press Enter or the space bar when the pill's remove button receives focus. On mobile devices, you can tap the remove button to remove a pill.
For pills with links, use the Tab key or arrow keys to focus on the pill's link, then press Enter to navigate to the link target. If you don't navigate away from the pill, tabbing again puts focus on the remove button.
## Custom Events
**`itemremove`**
The event fired when a pill is removed.
The `itemremove` event returns the following parameters.
| Parameter | Type | Description |
| --------- | ------ | -------------------------------------- |
| item | string | The name of the pill that's removed. |
| index | number | The position of the pill in the array. |
The event properties are as follows.
| Property | Value | Description |
| ---------- | ----- | ------------------------------------------------------------------------------ |
| bubbles | false | This event does not bubble. |
| cancelable | true | This event can be canceled. You can call `preventDefault()` on this event. |
| composed | false | This event does not propagate outside the template in which it was dispatched. |
:::::
:::::tab
::component-specification{component="pillContainer" model="lwc" namespace="lightning"}
:::::
::::::
# Platform Navigation Item API
**`lightning/platformNavigationItemApi`**
Work with navigation items in the menu of a Lightning console app by using the `lightning/platformNavigationItemApi` module. The `lightning/platformNavigationItemApi` module requires API version 67.0 or later.
**For Use In**
Lightning Experience
::::::tabset{tabs='[ "Develop", "Specifications" ]'}
:::::tab
The `lightning/platformNavigationItemApi` module provides methods to control navigation items in the menu of a Lightning console app. All the methods return a promise. The `setSelectedNavigationItem` method requires the navigation item's `developerName` to be passed as an argument. The other methods take no arguments.
To use the Navigation Item API in your component, import the functions in your component's JavaScript file.
```javascript
import {
focusNavigationItem,
getNavigationItems,
getSelectedNavigationItem,
refreshNavigationItem,
setSelectedNavigationItem,
} from "lightning/platformNavigationItemApi";
```
This example selects the Accounts navigation item in the Lightning console app.
```javascript
// c/myComponent.js
import { LightningElement, wire } from "lwc";
import {
IsConsoleNavigation,
setSelectedNavigationItem,
} from "lightning/platformNavigationItemApi";
export default class MyComponent extends LightningElement {
@wire(IsConsoleNavigation) isConsoleNavigation;
onSelectAccounts(event) {
if (!this.isConsoleNavigation) {
return;
}
setSelectedNavigationItem("standard-Account").then((isSelected) => {
console.log(
`Select navigation item ${isSelected ? "successfully" : "failed"}`,
);
});
}
}
```
For this module's documentation, see [Methods for Navigation Items in Lightning Experience](https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_methods_lightning_navigationItemAPI.htm) in the Console Developer Guide.
:::::
:::::tab
::component-specification{component="platformNavigationItemApi" model="lwc" namespace="lightning"}
:::::
::::::
# Platform Resource Loader
**`lightning/platformResourceLoader`**
Use third-party libraries that are uploaded as a static resource in your org.
**For Use In**
Lightning Experience
::::::tabset{tabs='[ "Develop", "Specifications"]'}
:::::tab
The `lightning/platformResourceLoader` module has two methods, `loadScript` and `loadStyle`. Both methods create and return promises, which can be chained or used in parallel. You control the load sequence of your scripts or styles. In your component's JavaScript file, import the functions from the `lightning/platformResourceLoader` module.
```javascript
import { loadStyle, loadScript } from "lightning/platformResourceLoader";
```
## `loadScript(self, fileUrl): Promise`
Accesses a .js file in a static resource. Returns a promise that resolves after the file has loaded.
- `self` - A reference to the component. The value must be `this`.
- `fileUrl` - A string that contains the path to the JavaScript file. To build the string, concatenate the resourceName and the path to the file within the static resource archive.
## `loadStyle(self, fileUrl): Promise`
Accesses a .css file in a static resource. Returns a promise that resolves after the file has loaded.
- `self` - A reference to the component. The value must be `this`.
- `fileUrl` - A string that contains the path to the CSS file. To build the string, concatenate the resourceName and the path to the file within the static resource archive.
## Usage
To import a third-party JavaScript or CSS library, use the `platformResourceLoader` module.
1. Download the JavaScript or CSS files from the third-party library's site.
2. Upload the library to your Salesforce organization as a static resource, which is a Lightning security requirement for using third-party code. For more information, see [Access Static Resources](https://developer.salesforce.com/docs/platform/lwc/guide/create-resources.html) in the _Lightning Web Components Developer Guide_.
3. In a component's JavaScript file:
- Import the static resource.
`import myResourceName from '@salesforce/resourceUrl/myResourceName';`
- Import methods from the `platformResourceLoader` module. Dynamic imports of this module aren’t allowed.
`import { loadStyle, loadScript } from 'lightning/platformResourceLoader';`
4. Load the library and call its functions in a promise `then()` method.
```javascript
loadScript(this, myResourceName + "/myResourceName.js").then(() => {
// your code with calls to the JS library
});
```
This example shows how to use `platformResourceLoader` with the Leaflet library to create an interactive map.
```javascript
import { LightningElement } from "lwc";
import { loadStyle, loadScript } from "lightning/platformResourceLoader";
import leaflet from "@salesforce/resourceUrl/leaflet";
export default class MyMap extends LightningElement {
// invoke the loaders in connectedCallback() to ensure that
// the page loads and renders the container before the map is created
connectedCallback() {
Promise.all([
loadStyle(this, leaflet + "/leaflet.css"),
loadScript(this, leaflet + "/leaflet.js"),
]).then(() => {
// initialize the library using a reference to the container element obtained from the DOM
const el = this.template.querySelector("div");
const mymap = L.map(el).setView([51.505, -0.09], 13);
// Load and display tile layers with your access token
L.tileLayer(
"https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}",
{
maxZoom: 18,
id: "mapbox.streets",
accessToken: "your.mapbox.access.token",
},
).addTo(mymap);
});
}
}
```
### Aura Components That Load the Same Script
If an Aura component uses [`ltng:require`](/docs/platform/lightning-component-reference/guide/ltng-require.html) to load a script url, and an LWC component uses `loadScript` from `lightning/platformResourceLoader` to load the same script url in the same page, the script duplication is not detected and the script is loaded twice. The script must protect itself from duplication, for instance by checking if a global is already defined.
## LWC Recipes
The [LWC Recipes GitHub repository](https://github.com/trailheadapps/lwc-recipes) contains code examples for Lightning Web Components that you can test in an org.
For a recipe that uses `lightning/platformResourceLoader`, see these components in the LWC Recipes repo.
- `c-libs-chartjs`
- `c-libs-d3`
## See Also
[Use Third-Party JavaScript Libraries](https://developer.salesforce.com/docs/platform/lwc/guide/js-third-party-library)
[Access Static Resources](https://developer.salesforce.com/docs/platform/lwc/guide/create-resources)
:::::
:::::tab
::component-specification{component="platformResourceLoader" model="lwc" namespace="lightning"}
:::::
::::::
# Platform Show Toast Event (Beta)
**`lightning/platformShowToastEvent`**
Provides feedback and confirmation after a user action.
**For Use In**
Lightning Experience, Experience Builder Sites, Salesforce Mobile App
::::::tabset{tabs='[ "Develop", "Specifications"]'}
:::::tab
Display toasts to provide feedback to a user following an action, such as after a record is created.
`lightning/platformShowToastEvent` isn't supported in LWR sites for Experience Cloud. Use `lightning/toast` in LWR sites instead. To specify your toast position and the maximum number of toasts to display, use `lightning/platformShowToastEvent` or `lightning/toast` with `lightning/toastContainer`.
You can style a toast to provide information, an error, a success, or a warning. You can also configure the visibility of the toast. It remains visible for 20 seconds, until the user clicks to dismiss it, or a combination of both.
To trigger a toast from a Lightning web component, in the component's JavaScript class, import `ShowToastEvent` from `lightning/platformShowToastEvent`. Create a `ShowToastEvent` with a few parameters, and dispatch it. The app handles the rest.
In this example, when a user clicks the button, the app displays a
toast with the `info` variant, which is the default. The toast remains visible for 20 seconds or until the user clicks the close
button, denoted by the X in the top right corner, which is also the default.
```html
```
The `showToast` function creates and dispatches the event. An info toast displays in Lightning Experience for 5 seconds or until the user clicks to close it.
```javascript
import { LightningElement } from "lwc";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
export default class MyComponent extends LightningElement {
showToast() {
const event = new ShowToastEvent({
title: "Get Help",
message:
"Salesforce documentation is available in the app. Click ? in the upper-right corner.",
});
this.dispatchEvent(event);
}
}
```
## Displaying Links in Toasts
To display a link in the message, use the `messageData` attribute to pass in `url` and `label` values for the `message` string. In the following example, `handleButtonClick()` displays a toast with a link in the message. `handleRecordClick()` displays a toast with a link to a record, which uses the `lightning/navigation` module to generate the URL.
```javascript
import { LightningElement } from "lwc";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import { NavigationMixin } from "lightning/navigation";
export default class LightningToastExample extends NavigationMixin(LightningElement) {
handleButtonClick() {
const event = new ShowToastEvent({
title: "Success!",
message: "Record {0} created! See it {1}!",
messageData: [
"Salesforce",
{
url: "http://www.salesforce.com/",
label: "here",
},
],
});
this.dispatchEvent(event);
}
handleRecordClick() {
this[NavigationMixin.GenerateUrl]({
type: "standard__recordPage",
attributes: {
recordId: "003xx000000001eAAA",
actionName: "view",
},
}).then((url) => {
const event = new ShowToastEvent({
title: "Success!",
message: "Record {0} created! See it {1}!",
messageData: [
"Salesforce",
{
url,
label: "here",
},
],
});
this.dispatchEvent(event);
});
}
}
```
## Parameters
| Parameter | Type | Description |
| ------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `title` | String | (Required) The title of the toast, displayed as a heading. |
| `message` | String | (Required) A string representing the body of the message. It can contain placeholders in the form of `{0} ... {N}`. The placeholders are replaced with the links on `messageData`. |
| `messageData` | String[] or Object | `url` and `label` values that replace the `{index}` placeholders in the `message` string. |
| `variant` | String | Changes the appearance of the notice. Toasts inherit styling from [toasts](https://v1.lightningdesignsystem.com/components/toast) in the Lightning Design System. Valid values are: `info` (default), `success`, `warning`, and `error`. |
| `mode` | String | Determines how persistent the toast is. Valid values are: `dismissible` (default), remains visible until you click the close button or 20 seconds has elapsed, whichever comes first; `pester`, remains visible for 20 seconds and disappears automatically. No close button is provided; `sticky`, remains visible until you click the close button. |
## Design Guidelines
A toast appears in reaction to a user action: creating, editing, deleting. For example, a user edits a record and saves it. For more information, see [Messaging Design Guidelines](https://lightningdesignsystem.com/guidelines/messaging/overview/).
## Usage Considerations
`lightning/platformShowToastEvent` uses an event-based mechanism to display a toast, and it's not supported in environments like LWR sites for Experience Cloud or standalone apps. We recommend that you use [lightning/toast](/docs/platform/lightning-component-reference/guide/lightning-toast.html) instead.
This component has usage differences from its Aura counterpart. See [Base Components: Aura Vs Lightning Web Components](https://developer.salesforce.com/docs/platform/lwc/guide/migrate-map-aura-lwc-components) in the Lightning Web Components Developer Guide.
## LWC Recipes
The [LWC Recipes GitHub repository](https://github.com/trailheadapps/lwc-recipes) contains code examples for Lightning Web Components that you can test in an org.
For a recipe that uses `lightning/platformShowToastEvent`, see the following components in the LWC Recipes repo.
- `c-lds-create-record`
- `c-misc-toast-notification`
## See Also
[Toast Notifications](https://developer.salesforce.com/docs/platform/lwc/guide/use-toast)
:::::
:::::tab
::component-specification{component="platformShowToastEvent" model="lwc" namespace="lightning"}
:::::
::::::
# Platform Utility Bar API
**`lightning/platformUtilityBarApi`**
Work with a utility within the utility bar of a Lightning app using the `lightning/platformUtilityBarApi` module. The utility bar is a footer that gives users quick access to frequently used tools and components. Each utility is a single-column Lightning page that includes a standard or custom Lightning component. The `lightning/platformUtilityBarApi` module requires API version 61.0 or later.
**For Use In**
Lightning Experience
::::::tabset{tabs='[ "Develop", "Specifications" ]'}
:::::tab
The `lightning/platformUtilityBarApi` module provides LWC Utility Bar API methods to control a utility within the utility bar of a Lightning app. All the methods in the `lightning/platformUtilityBarApi` module return a Promise. Required method parameters are explicitly passed as individual arguments. Optional parameters are passed into an object as the last argument of the method.
To use the Utility Bar API in your component, import the functions in your component's JavaScript file.
```javascript
import {
enableModal,
enablePopout,
getAllUtilityInfo,
getUtilityInfo,
minimize,
onUtilityClick,
open,
updatePanel,
updateUtility,
} from "lightning/platformUtilityBarApi";
```
The following example minimizes an open utility panel.
```javascript
// c/myComponent.js
import { LightningElement, wire } from "lwc";
import { EnclosingUtilityId, minimize } from "lightning/platformUtilityBarApi";
export default class MyComponent extends LightningElement {
@wire(EnclosingUtilityId) utilityId;
onMinimize(event) {
if (!this.utilityId) {
return;
}
minimize(this.utilityId).then((isMinimized) => {
console.log(`Minimize utilty ${isMinimized ? "successfully" : "failed"}`);
});
}
}
```
For this module's documentation, see [Methods for the Utility Bar in Lightning Experience](https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_methods_lightning_utilityBarAPI.htm) in the Console Developer Guide.
:::::
:::::tab
::component-specification{component="platformUtilityBarApi" model="lwc" namespace="lightning"}
:::::
::::::
# Platform Workspace API
**`lightning/platformWorkspaceApi`**
Work with workspace tabs and subtabs in a Lightning console app using the `lightning/platformWorkspaceApi` module. The `lightning/platformWorkspaceApi` module requires API version 59.0 or later.
**For Use In**
Lightning Experience
::::::tabset{tabs='[ "Develop", "Specifications" ]'}
:::::tab
The `lightning/platformWorkspaceApi` module provides LWC Workspace API methods to control workspace tabs and subtabs in a Lightning console app. All the methods in the `lightning/platformWorkspaceApi` module return a promise. Required method parameters are explicitly passed as individual arguments. Optional parameters are passed into an object as the last argument of the method.
To use the Workspace API in your component, import the functions in your component's JavaScript file.
```javascript
import {
EnclosingTabId,
IsConsoleNavigation,
closeTab,
disableTabClose,
focusTab,
getAllTabInfo,
getFocusedTabInfo,
getTabInfo,
openSubtab,
openTab,
refreshTab,
setTabHighlighted,
setTabIcon,
setTabLabel,
} from "lightning/platformWorkspaceApi";
```
The following example toggles the highlight of a focused tab in the Lightning console app.
```javascript
// c/myComponent.js
import { LightningElement, wire } from "lwc";
import {
IsConsoleNavigation,
getFocusedTabInfo,
setTabHighlighted,
} from "lightning/platformWorkspaceApi";
export default class MyComponent extends LightningElement {
@wire(IsConsoleNavigation) isConsoleNavigation;
onToggleHighlightTab(event) {
if (!this.isConsoleNavigation) {
return;
}
const { highlighted } = event.detail;
getFocusedTabInfo().then((tabInfo) => {
const { tabId } = tabInfo;
setTabHighlighted(tabId, highlighted, {
pulse: true,
state: "success",
});
});
}
}
```
For this module's documentation, see [Methods for Workspace Tabs and Subtabs in Lightning Experience](https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_methods_lightning_workspaceAPI.htm) in the Console Developer Guide.
To work with Lightning console app events in your component, subscribe to the [Lightning message channels for the Aura application events](https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_js_events.htm) that you want to listen for.
:::::
:::::tab
::component-specification{component="platformWorkspaceApi" model="lwc" namespace="lightning"}
:::::
::::::
# Post Created
**`forceChatter:postCreated`**
Fired when a post is made.
::::::tabset{tabs='[ "Develop", "Specifications"]'}
:::::tab
This event is fired when a post is created on the publisher, such as when you post to your profile feed and other feeds, create a poll, or create a question.
Handle the event by adding an `aura:handler` tag and defining a client-side controller action. You can handle this event when using `forceChatter:publisher` and `forceChatter:feed`, or on any page that has a publisher.
This example displays a toast message when a post is created, assuming the component is added to a record page. The toast is displayed when you create a post on the record page.
```xml
```
This client-side controller displays the toast.
```javascript
handlePostCreated: function(cmp, event, helper) {
cmp.find('notifLib').showToast({
"title": "Success!",
"message": "You just shared a post."
});
}
```
This event is handled by the `one.app` container. It’s supported in Lightning Experience, the Salesforce mobile app, and Aura-based Experience Builder sites.
:::::
:::::tab
## Attributes
| Name | Description | Type | Default | Required |
| ------------ | ---------------------------------------------- | ------ | ------- | -------- |
| `feedItemId` | The ID of the feed item that has been created. | string | | |
:::::
::::::
# Profile Menu Interface
**`forceCommunity:profileMenuInterface`**
Enables a component to be used as a custom profile menu in Experience Builder.
**For Use In**
Experience Builder Sites
::::::tabset{tabs='["Develop", "Specifications"]'}
:::::tab
To appear in Experience Builder as a custom profile menu, a component must implement `forceCommunity:profileMenuInterface`.
Here's the sample code for a simple profile menu component.
```xml
```
After you create a custom profile menu component, admins can select it in Experience Builder in Settings | Theme to replace the template’s standard Profile Header component.
:::::
:::::tab

:::::
::::::
# Progress Bar
**`lightning-progress-bar`**
Displays a horizontal progress bar from left to right to indicate the progress of an operation.
**For Use In**
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline
::::::tabset{tabs='["Example", "Develop", "Specifications"]'}
:::::tab
::component-playground{component="progressBar" model="lwc" namespace="lightning"}
:::::
:::::tab
A `lightning-progress-bar` component shows the progress of an operation from
left to right, such as for a file download or upload.
This example loads the progress bar when you click the Start button.
The Start button becomes a Stop button when the progress bar is incrementing its value.
```html
```
Here's the JavaScript that changes the value of the progress bar.
Specifying `this.progress === 100 ? this.resetProgress() : this.progress + 10`
increases the progress value by 10% and stops the animation when the progress
reaches 100%. The progress bar is updated every 200 milliseconds.
```javascript
import { LightningElement } from "lwc";
export default class DemoComponent extends LightningElement {
progress = 0;
isProgressing = false;
updateProgress() {
this.progress = this.progress === 100 ? this.resetProgress() : this.progress + 10;
}
resetProgress() {
this.progress = 0;
clearInterval(this._interval);
}
disconnectedCallback() {
clearInterval(this._interval);
}
get computedLabel() {
return this.isProgressing ? "Stop" : "Start";
}
toggleProgress() {
if (this.isProgressing) {
// stop
this.isProgressing = false;
if (!this.progress) {
this.progress = 0;
}
clearInterval(this._interval);
} else {
// start
this.isProgressing = true;
this._interval = setInterval(this.updateProgress.bind(this), 200);
}
}
}
```
## Design
`lightning-progress-bar` implements the progress bar blueprint in the Salesforce Lightning Design System (SLDS). The progress bar adapt to SLDS 1 or SLDS 2 styling based on the org's theme or the container app that you use.
| | SLDS 1 | SLDS 2 |
| :------------- | :------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------- |
| **Design** | [Progress Bars](https://v1.lightningdesignsystem.com/components/progress-bar/) | [Progress Bars](https://www.lightningdesignsystem.com/components/progress-bar/) |
| **For Use In** | Lightning Experience, Experience Builder sites, Salesforce mobile app, Lightning Out (Beta), Standalone Lightning app, Mobile Offline | [Lightning Experience](https://help.salesforce.com/s/articleView?id=xcloud.customize_ui_enhancedlex.htm&type=5) |
## Component Styling
Use a combination of variants, sizes, and utility classes to customize the progress bar.
### Variants
Specify the `variant` attribute using one of these values.
- `base` is the default variant, which shows a rectangular progress bar
- `circular` shows a progress bar with rounded ends
### Sizes
Adjust the progress bar sizes by using the `size` attribute with one of these values.
- `x-small` creates a progress bar with a height of 2px
- `small` creates a progress bar with a height of 4px
- `medium` is the default variant, which creates a progress bar with a height of 8px
- `large` creates a progress bar with a height of 12px
### Utility Classes
To apply additional styling, use the SLDS [utility classes](https://v1.lightningdesignsystem.com/utilities/alignment) with the `class` attribute.
:::::
:::::tab
::component-specification{component="progressBar" model="lwc" namespace="lightning"}
:::::
::::::
# Progress Indicator (Beta)
**`lightning-progress-indicator`**
Provides a visual indication on the progress of a particular process.
**For Use In**
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline
::::::tabset{tabs='["Example", "Develop", "Specifications"]'}
:::::tab
::component-playground{component="progressIndicator" model="lwc" namespace="lightning"}
:::::
:::::tab
**note:** `lightning-progress-indicator` is a pilot or beta service that is subject to the Beta Services Terms at [Agreements - Salesforce.com](https://www.salesforce.com/company/legal/agreements/) or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the [Product Terms Directory](https://ptd.salesforce.com/). Use of this pilot or beta service is at the Customer's sole discretion.
A `lightning-progress-indicator` component shows a horizontal list of steps
in a process, indicating:
- The number of steps in a given process
- The current step
- The prior steps that are completed
For example, Sales Path uses a progress indicator to guide sales reps through the stages of the sales process.
To create steps, use one or more `lightning-progress-step` component along with `label` and `value` attributes. To specify the current step, the `current-step`
attribute must match one of the `value` attributes on a
`lightning-progress-step` component.
```html
```
## Design
`lightning-progress-indicator` implements several designs in the Salesforce Lightning Design System (SLDS). The designs adapt to SLDS 1 or SLDS 2 styling based on the org's theme or the container app that you use.
| | SLDS 1 | SLDS 2 |
| :----------------------- | :------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------- |
| **Design** (`base` type) | [Progress Indicator](https://v1.lightningdesignsystem.com/components/progress-indicator/) | [Progress Indicator](https://www.lightningdesignsystem.com/components/progress-indicator/) |
| **Design** (`path` type) | [Path](https://v1.lightningdesignsystem.com/components/path/) | [Path](https://www.lightningdesignsystem.com/components/path/) |
| **For Use In** | Lightning Experience, Experience Builder sites, Salesforce mobile app, Lightning Out (Beta), Standalone Lightning app, Mobile Offline | [Lightning Experience](https://help.salesforce.com/s/articleView?id=xcloud.customize_ui_enhancedlex.htm&type=5) |
You can create progress indicators with different visual styling by specifying
the `type` attribute.
- Set `type="base"` to create a progress indicator. The vertical progress indicator isn't currently supported.
- Set `type="path"` to create a path. Stage coaching information isn't currently supported.
If the type isn’t specified, the default type `base` is used.
The `label` value is displayed in a tooltip when you hover
over the step. If the progress indicator type is `path`, the label appears on hover if the step is completed or on the step itself if it's a
current or incomplete step.
## Create a Path Type Progress Indicator
This example creates a path showing the current step at "Step Two". "Step One"
is marked completed and "Step Three" isn’t yet completed.
```html
```
The component shows the current step in an active state. It marks all steps preceding the current step as completed.
## Implement the Error State
To denote an error on the current step, set `has-error` to `true`. Only the `base` type supports the error state.
This example creates a progress indicator that updates to the next step and applies an error on the current step.
```html
```
Applying an error state on the current step updates the completed icon to an error icon,
similar to the [progress indicator](https://v1.lightningdesignsystem.com/components/progress-indicator/#Error-in-a-Step) SLDS blueprint.
```js
import { LightningElement } from "lwc";
export default class ProgressIndicatorError extends LightningElement {
current = "s3";
error = false;
nextStep() {
this.current = "s4";
}
addError() {
this.error = true;
}
}
```
## Accessibility
Each progress step is rendered with assistive text, which is constructed from the step's label and a description of the step's state.
For example, for a step labeled Contacted, the assistive text is "Contacted - Current Stage" when the step is the current step, and "Contacted - Stage Complete" when the step is completed. The text of the step's state can't be changed.
| Step | Assistive Text |
| --------- | ---------------------- |
| Current | Label - Current Stage |
| Inactive | Label |
| Completed | Label - Stage Complete |
| Error | Label |
The assistive text for a step that's inactive or has an error doesn't include information about the step's state.
For the `base` type, you can use the Tab key to navigate from one step to the next. Each step connects to the next
step with a horizontal progress bar, such that two steps share one bar.
Press Shift+Tab to go to the previous step. The progress bar renders with `aria-valuenow` set to a scale of 0 to 100,
which defines the current value for the progress bar. For example, if you have 4 steps and the third step is the current,
`aria-valuenow` is set to 66, since 2 out of 3 bars are marked as completed.
Similarly, the `aria-valuemin` and `aria-valuemax` attributes are set to 0 and 100 respectively.
For the `path` type, press Tab to set focus on the active stage and use the Up and Down Arrow keys
or the Left and Right arrow keys to navigate from one stage to another. The `aria-selected` attribute on the hyperlink element associated with the stage is set to `true` when a stage receives focus and `false` when it doesn't receive focus.
When you navigate away from the current active stage, the stage remains the current stage but the shift in focus makes it inactive. The current stage changes color from dark blue to white to indicate it's not the active stage.
Consider these additional scenarios.
- Navigating to an incomplete stage makes it an active incomplete stage, which changes its color from gray to dark blue
- Navigating to a completed stage makes it an active completed stage, which changes its color from green to dark blue
:::::
:::::tab
::component-specification{component="progressIndicator" model="lwc" namespace="lightning"}
:::::
::::::
# Progress Ring
**`lightning-progress-ring`**
Displays a circular progress indicator to provide feedback about an action or process. This component requires API version 48.0 and later.
**For Use In**
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline
::::::tabset{tabs='["Example", "Develop", "Specifications"]'}
:::::tab
::component-playground{component="progressRing" model="lwc" namespace="lightning"}
:::::
:::::tab
A `lightning-progress-ring` component is a circular progress indicator. It shows a value from 0 to 100 by filling the ring with a green color by default, and supports variants to change its styling. The color fill is displayed in a clockwise or counterclockwise direction. It informs users the status of a process or action, such as loading data or saving updates.
This example creates a progress ring in a clockwise direction with a value of 75, which fills three quarters of the ring, or 75%.
```html
```
## Design
`lightning-progress-ring` implements the progress bar blueprint in the Salesforce Lightning Design System (SLDS). The progress ring adapts to SLDS 1 or SLDS 2 styling based on the org's theme or the container app that you use.
| | SLDS 1 | SLDS 2 |
| :------------- | :------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------- |
| **Design** | [Progress Ring](https://v1.lightningdesignsystem.com/components/progress-ring/) | [Progress Ring](https://www.lightningdesignsystem.com/components/progress-ring/) |
| **For Use In** | Lightning Experience, Experience Builder sites, Salesforce mobile app, Lightning Out (Beta), Standalone Lightning app, Mobile Offline | [Lightning Experience](https://help.salesforce.com/s/articleView?id=xcloud.customize_ui_enhancedlex.htm&type=5) |
## Component Styling
Use a combination of variants, sizes, and utility classes to customize the progress bar.
### Variants
Use variants to change the ring's styling to provide contextual feedback to users, such as whether an action is successful, active, at risk of failing, or unsuccessful.
By default, the progress ring fills in with green as the value increases, to indicate success.
```html
```
To display an active step in blue, use the `active-step` variant. This variant indicates that the progress status is ongoing and not yet determined to be successful, at risk of failing, or unsuccessful.
```html
```
To indicate a problem with an action or process, use the `warning` variant.
This variant displays the warning icon inside the ring and uses a yellow fill color.
```html
```
To indicate an unsuccessful action or process, use the `expired` variant.
This variant displays the error icon inside the ring and uses a red fill color.
```html
```
To indicate a successful action or process, use the `base-autocomplete` variant. This variant is styled the same as the default `base` variant when the value is 0 to 99. When the value is 100, the success icon displays as a checkmark on a green background matching the fill color of the ring.
```html
```
### Sizes
Adjust the progress ring sizes by using the `size` attribute with one of these values.
- `medium` is the default variant, which displays the progress ring with a dimension of 24px by 24px
- `large` displays the progress ring with a dimension of 32px by 32px
### Utility Classes
To apply additional styling, use the SLDS [utility classes](https://v1.lightningdesignsystem.com/utilities/alignment) with the `class` attribute.
## Accessibility
The `warning`, `expired`, and `base-autocomplete` variants provide icons and descriptive text for accessibility. The `active-step` variant currently does not have either, so it's not accessible. The `active-step` and `base` default variant appear the same except for color. Consider this accessibility limitation when using the `active-step` variant.
:::::
:::::tab
::component-specification{component="progressRing" model="lwc" namespace="lightning"}
:::::
::::::
# Progress Step (Beta)
**`lightning-progress-step`**
Defines a step in the lightning-progress-indicator.
**For Use In**
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline
::::::tabset{tabs='["Example", "Develop", "Specifications"]'}
:::::tab
::component-playground{component="progressStep" model="lwc" namespace="lightning"}
:::::
:::::tab
**note:** `lightning-progress-step` is a pilot or beta service that is subject to the Beta Services Terms at [Agreements - Salesforce.com](https://www.salesforce.com/company/legal/agreements/) or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the [Product Terms Directory](https://ptd.salesforce.com/). Use of this pilot or beta service is at the Customer's sole discretion.
A `lightning-progress-step` component specifies a step inside the [`lightning-progress-indicator`](/docs/platform/lightning-component-reference/guide/lightning-progress-indicator.html) component.
Specify the `label` attribute to define the text for the name or tooltip for the step.
Specify the `value` attribute to set the value used to reference the step.
To specify the current step, the `current-step` attribute on `lightning-progress-indicator`
must match one of the `value` attributes on a `lightning-progress-step` component.
```html
```
If the progress indicator type isn’t specified or is set to `base`, the
`label` text appears in a tooltip when you hover
over the step.
If the progress indicator type is `path`, the label appears on hover if the step is completed or on the step itself if it's a
current or incomplete step.
For `base` type progress indicators, custom events implemented in `lightning-progress-step` fire during user interactions with the steps. Each event returns the index of the step. See the **Custom Events** section for more information.
For example, to get the index of the step that released focus, use the `event.detail` property on the `onstepblur` event handler.
```html
```
```javascript
import { LightningElement } from "lwc";
export default class MyDemoComponent extends LightningElement {
handleStepBlur(event) {
const stepIndex = event.detail.index;
}
}
```
## Design
Use `lightning-progress-step` within `lightning-progress-indicator`, which implements several designs in the Salesforce Lightning Design System (SLDS). The designs adapt to SLDS 1 or SLDS 2 styling based on the org's theme or the container app that you use.
| | SLDS 1 | SLDS 2 |
| :----------------------- | :------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------- |
| **Design** (`base` type) | [Progress Indicator](https://v1.lightningdesignsystem.com/components/progress-indicator/) | [Progress Indicator](https://www.lightningdesignsystem.com/components/progress-indicator/) |
| **Design** (`path` type) | [Path](https://v1.lightningdesignsystem.com/components/path/) | [Path](https://www.lightningdesignsystem.com/components/path/) |
| **For Use In** | Lightning Experience, Experience Builder sites, Salesforce mobile app, Lightning Out (Beta), Standalone Lightning app, Mobile Offline | [Lightning Experience](https://help.salesforce.com/s/articleView?id=xcloud.customize_ui_enhancedlex.htm&type=5) |
## Usage Considerations
`lightning-progress-step` supports the custom events listed in the next section. It doesn't support the `click` event. To enable users to interactively update their progress to the next or previous steps, include a clickable element that updates the `current-step` value on `lightning-progress-indicator`. For more information, see the [lightning-progress-step documentation](/docs/platform/lightning-component-reference/guide/lightning-progress-step.html).
## Custom Events
The `lightning-progress-step` component supports these events for the `base` type of `lightning-progress-indicator`.
**`stepblur`**
The event fired when a step releases focus.
The `stepblur` event returns this parameter.
| Parameter | Type | Description |
| --------- | ------ | ------------------------------------------ |
| index | string | The index of the step that released focus. |
The event properties are as follows.
| Property | Value | Description |
| ---------- | ----- | --------------------------------------------------------------------------------------------------------- |
| bubbles | true | This event bubbles up through the DOM. |
| cancelable | false | This event has no default behavior that can be canceled. You can't call `preventDefault()` on this event. |
| composed | false | This event does not propagate outside of the component in which it was dispatched. |
**`stepfocus`**
The event fired when a step receives focus.
The `stepfocus` event returns the following parameter.
| Parameter | Type | Description |
| --------- | ------ | ------------------------------------------ |
| index | string | The index of the step that received focus. |
The event properties are as follows.
| Property | Value | Description |
| ---------- | ----- | --------------------------------------------------------------------------------------------------------- |
| bubbles | true | This event bubbles up through the DOM. |
| cancelable | false | This event has no default behavior that can be canceled. You can't call `preventDefault()` on this event. |
| composed | false | This event does not propagate outside of the component in which it was dispatched. |
**`stepmouseenter`**
The event fired when the mouse pointer moves onto the step.
The `stepmouseenter` event returns the following parameter.
| Parameter | Type | Description |
| --------- | ------ | --------------------------------------------------- |
| index | string | The index of the step the mouse pointer moves onto. |
The event properties are as follows.
| Property | Value | Description |
| ---------- | ----- | --------------------------------------------------------------------------------------------------------- |
| bubbles | true | This event bubbles up through the DOM. |
| cancelable | false | This event has no default behavior that can be canceled. You can't call `preventDefault()` on this event. |
| composed | false | This event does not propagate outside of the component in which it was dispatched. |
**`stepmouseleave`**
The event fired when the mouse pointer moves off the step.
The `stepmouseleave` event returns the following parameter.
| Parameter | Type | Description |
| --------- | ------ | ----------------------------------------------------- |
| index | string | The index of the step the mouse pointer moves out of. |
The event properties are as follows.
| Property | Value | Description |
| ---------- | ----- | --------------------------------------------------------------------------------------------------------- |
| bubbles | true | This event bubbles up through the DOM. |
| cancelable | false | This event has no default behavior that can be canceled. You can't call `preventDefault()` on this event. |
| composed | false | This event does not propagate outside of the component in which it was dispatched. |
## Accessibility
Each progress step is decorated with assistive text, which is also the label
of that step. For the `base` type, you can use the Tab key to navigate from one
step to the next. Press Shift+Tab to go to the previous step. For the `path`
type, press Tab to activate the current step and use the Up and Down Arrow key
or the Left and Right arrow key to navigate from one step to another.
:::::
:::::tab
::component-specification{component="progressStep" model="lwc" namespace="lightning"}
:::::
::::::
# Prompt
**`lightning-prompt`**
Create a prompt modal within your component that asks the user to provide information before they continue.
**For Use In**
Lightning Experience, Experience Builder Sites, Lightning Out (Beta), Standalone Lightning App
::::::tabset{tabs='["Example", "Develop", "Specifications"]'}
:::::tab
::component-playground{component="prompt" model="lwc" namespace="lightning"}
:::::
:::::tab
The `lightning/prompt` module provides the `LightningPrompt` component to create a prompt modal within your component. Use `LightningPrompt` on a component to ask the user to provide information before they continue.
**note:** Use `LightningPrompt.open()` instead of the native `window.prompt()` for a more consistent user experience. They have similar functions, but `LightningPrompt.open()` works in cross-origin iframes, where the `.prompt()` method is no longer supported in Chrome and Safari. Unlike `window.prompt()`, `LightningPrompt.open()` doesn't halt execution on the page, it returns a Promise. Use `async`/`await` or `.then()` for any code you want to execute after the prompt has closed.
## Design
`lightning/prompt` implements the prompt blueprint in the Salesforce Lightning Design System (SLDS). The prompt adapts to SLDS 1 or SLDS 2 styling based on the org's theme or the container app that you use.
| | SLDS 1 | SLDS 2 |
| :------------- | :--------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------- |
| **Design** | [Prompt](https://v1.lightningdesignsystem.com/components/prompt/) | [Prompt](https://www.lightningdesignsystem.com/components/prompt/) |
| **For Use In** | Lightning Experience, Experience Builder sites, Lightning Out (Beta), Standalone Lightning app | [Lightning Experience](https://help.salesforce.com/s/articleView?id=xcloud.customize_ui_enhancedlex.htm&type=5) |
## Usage
Import `LightningPrompt` from the `lightning/prompt` module in the component that opens the prompt modal, and call `LightningPrompt.open()` with your desired attributes.
This example creates a prompt modal with a header, message, and two buttons. If you enter text and click **OK** in the prompt, the `.open()` function returns a promise that resolves to the input value. If you click **Cancel**, the function returns a promise that resolves to `null`.
```html
```
```javascript
import { LightningElement } from "lwc";
import LightningPrompt from "lightning/prompt";
export default class MyApp extends LightningElement {
handlePromptClick() {
LightningPrompt.open({
message: "this is the prompt message",
//theme defaults to "default"
label: "Please Respond", // this is the header text
defaultValue: "initial input value", //this is optional
}).then((result) => {
//Prompt has been closed
//result is input text if OK clicked
//and null if cancel was clicked
});
}
}
```
`LightningPrompt` supports these attributes:
- `message`: Message text that displays in the prompt.
- `defaultValue`: Optional. Initial leading text for the input text box.
- `label`: Header text, also used as the `aria-label`. Default string is `Prompt`.
- `variant`: See the [Variants](#variants) section.
- `theme`: See the [Themes](#themes) section.
## Component Styling
Use a combination of variants, themes, and utility classes to customize your prompts.
### Variants
Specify the `variant` attribute with one of these values.
- `header` is the default variant, which displays the prompt with header text
- `headerless` displays the prompt without header text
### Themes
Specify the `theme` attribute for the prompt header with one of these color [options](https://v1.lightningdesignsystem.com/utilities/themes) from SLDS.
- `default`: white
- `shade`: gray
- `inverse`: dark blue
- `alt-inverse`: darker blue
- `success`: green
- `info`: gray-ish blue
- `warning`: yellow
- `error`: red
- `offline`: black
If an invalid value is provided, `LightningPrompt` uses the `default` theme. `LightningPrompt` ignores the `style` attribute.
### Utility Classes
To apply additional styling, use the SLDS [utility classes](https://v1.lightningdesignsystem.com/utilities/alignment) with the `class` attribute.
## Test Your Prompt
Code using `LightningPrompt` can be tested by mocking the `LightningPrompt.open()` method.
This example uses a button to open a prompt dialog and sets the result in a template.
```html
Open Prompt
{result}
```
```js
import LightningPrompt from 'lightning/prompt';
jest.mock('lightning/prompt');
test(() => {
// Create and appendChild(element)
const buttonEle = element.shadowRoot.querySelector('[data-button]');
const resultEle = element.shadowRoot.querySelector('[data-result]');
// Mock .open()
// Pass string representing input text if testing when user clicks "OK"
// Pass null if testing when user clicks "Cancel"
LightningPrompt.open = jest.fn().mockResolvedValue('test value');
// Initial value
expect(resultEle.textContent).toBe('unknown');
// Click modal open button
buttonEle.click();
// Click handler render cycle
await Promise.resolve();
// Render cycle triggered by tracked value {result}
await Promise.resolve();
// Verify result is set in the template
expect(resultEle.textContent).toBe('test value');
// Open triggered once
expect(LightningPrompt.open.mock.calls).toHaveLength(1);
})
```
:::::
:::::tab
::component-specification{component="prompt" model="lwc" namespace="lightning"}
:::::
::::::
# Quick Action Panel (Beta)
**`lightning-quick-action-panel`**
Creates a modal with a body and a footer for a custom quick action.
**For Use In**
Lightning Experience
::::::tabset{tabs='[ "Develop", "Specifications"]'}
:::::tab
**note:** `lightning-quick-action-panel` is a pilot or beta service that is subject to the Beta Services Terms at [Agreements - Salesforce.com](https://www.salesforce.com/company/legal/agreements/) or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the [Product Terms Directory](https://ptd.salesforce.com/). Use of this pilot or beta service is at the Customer's sole discretion.
Use the `lightning-quick-action-panel` component (Beta) to build your own action modals that use the Salesforce Lightning Design System (SLDS) modal styling. You can create custom screen actions and maintain a consistent UI across all actions, including standard Salesforce and Aura Lightning quick actions.

This component has a `header` attribute and two slots:
- The default slot for the body
- A `footer` slot for custom footer actions
The modal header renders only if you set the `header` attribute to a non-empty string. The modal footer renders only if you set the `footer` slot.
This example creates a simple modal with a header, body, and footer.
```html
Here's some content for the modal body.
```
## Design
`lightning-quick-action-panel` implements the modal blueprint in the Salesforce Lightning Design System (SLDS). The modal adapts to SLDS 1 or SLDS 2 styling based on the org's theme or the container app that you use.
| | SLDS 1 | SLDS 2 |
| :------------- | :---------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------- |
| **Design** | [Modals](https://v1.lightningdesignsystem.com/components/modals/) | [Modals](https://www.lightningdesignsystem.com/components/modals/) |
| **For Use In** | Lightning Experience | [Lightning Experience](https://help.salesforce.com/s/articleView?id=xcloud.customize_ui_enhancedlex.htm&type=5) |
## Create A Form in the Modal Body
You can create a form for the modal in one of several ways.
- Use the [lightning-record-edit-form component](/docs/platform/lightning-component-reference/guide/lightning-record-edit-form.html)
- Use the [lightning-record-form](/docs/platform/lightning-component-reference/guide/lightning-record-form.html) component
In both approaches, the cancel and submit buttons are nested within the component itself, so the footer slot isn't needed.
Alternatively, use `lightning-input` and `lightning-button` components. With this approach, use the `lightning-quick-action-panel` component's footer slot to contain the buttons. For more information, see [Quick Actions](https://developer.salesforce.com/docs/platform/lwc/guide/use-quick-actions).
## Enable the Component as a Screen Action
To enable your component to be used in an LWC screen action, add the `lightning__RecordAction` target to the `component.js-meta.xml` configuration file. This target designates the component as a record page action. For more information about `lightning__RecordAction`, see [XML Configuration File Elements](https://developer.salesforce.com/docs/platform/lwc/guide/reference-configuration-tags).
```js
52.0
true
lightning__RecordAction
ScreenAction
```
The `actionType` value can be `Action` or `ScreenAction`. It defaults to `ScreenAction`.
This configuration enables the component to appear under the **Lightning Web Component** menu in **Object Manager** so you can create a new action using the component. You must also add the action to the **Salesforce Mobile and Lightning Experience Actions** section of your page layout. For more information, see [Quick Actions](https://help.salesforce.com/articleView?id=platform.actions_overview.htm&type=5).
## Component Styling
`lightning-quick-action-panel` provides a consistent UI for your custom screen action, matching the UI for standard Salesforce and Aura Lightning quick actions.
This component implements the standard scrolling logic for Salesforce modals. When the text content reaches the maximum height, the header and footer remain fixed, and only the body content scrolls.
### Utility Classes
To apply additional styling, use the SLDS [utility classes](https://v1.lightningdesignsystem.com/utilities/alignment) with the `class` attribute.
This example adds padding around the content of the modal body.
```html
Hello!
```
Similarly, add a utility class such as `slds-m-left_x-small` to your `lightning-button` component in the footer for uniform spacing.
### Styling Hooks
Component styling hooks provide CSS custom properties that use the `--slds-c-*` prefix and they change styling for specific elements or properties of a component. Component styling hooks are supported for SLDS 1 only. See the [SLDS 1 component blueprints](https://v1.lightningdesignsystem.com/components/overview/) for available component styling hooks.
For more information, see [Style Components Using Lightning Design System Styling Hooks](https://developer.salesforce.com/docs/platform/lwc/guide/create-components-css-custom-properties) in the Lightning Web Components Developer Guide.
## Usage Considerations
This component uses SLDS styling. If you want a fully customized component and action modal, create your own component markup and styling. Provide your markup without using `lightning-quick-action-panel` in the HTML template and include the configuration file as described in the [Enable the Component as a Screen Action](#enable-the-component-as-a-screen-action) section.
You can also create a custom action that directly executes your code without any UI, known as a _headless action_. For more information, see [Configure a Component for Quick Actions](https://developer.salesforce.com/docs/platform/lwc/guide/use-config-for-quick-actions).
The `lightning-record-form` component provides another way to create a form in the modal body.
To create links in the component that navigate to pages, records, or lists in Lightning Experience, use the [navigation service](/docs/platform/lightning-component-reference/guide/lightning-navigation.html).
## Accessibility
The modal window renders with `role="dialog"` and `aria-modal="true"`. A modal dialog traps focus.
When the modal opens, a user can't interact with the content behind the modal until they close the dialog.
The viewport behind the modal is marked with `aria-hidden="true"`, which prevents assistive technology from reading out the inactive content.
To close the modal, press the Esc key or click the X close button. Closing the modal moves focus back to the element that triggered the modal to open.
Press the Tab key to navigate through the focusable elements on the modal. Focus returns to the first focusable element at the top of modal, which is the X close button.
Press the Shift+Tab keys at the top of modal to return focus back to the last focusable element at the bottom of the modal.
## See Also
[Work with Records using Base Components](https://developer.salesforce.com/docs/platform/lwc/guide/data-get-user-input-intro)
[Configure a Component for Quick Actions](https://developer.salesforce.com/docs/platform/lwc/guide/use-config-for-quick-actions)
[_Salesforce Help_: Quick Actions](https://help.salesforce.com/articleView?id=platform.actions_overview.htm&type=5)
:::::
:::::tab
::component-specification{component="quickActionPanel" model="lwc" namespace="lightning"}
:::::
::::::
# Radio Group
**`lightning-radio-group`**
A radio button group that can have a single option selected.
**For Use In**
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline
::::::tabset{tabs='["Example", "Develop", "Specifications"]'}
:::::tab
::component-playground{component="radioGroup" model="lwc" namespace="lightning"}
:::::
:::::tab
A `lightning-radio-group` component represents a group of radio buttons that permit only
one button for selection at a time. The component renders radio button `
` elements
and assigns the same value to the `name` attribute for each element. The common
`name` attribute joins the elements in a group. If you select any radio button in that
group, any previously selected button in the group is deselected.
If you specify the `required` attribute, at least one radio button must be selected.
When a user interacts with the radio button group and doesn't make a selection, an
error message appears.
If you specify the `disabled` attribute, you can't interact with the radio buttons.
**note:** Setting the `name` attribute in `lightning-radio-group` isn't recommended.
The component automatically generates a unique value for `name` if none is provided. The generated value ensures a common name for the `
` elements rendered for the radio button group, and is unique on the page. See [Use Multiple Radio Groups on a Page](#use-multiple-radio-groups-on-a-page).
## Design
`lightning-radio-group` implements the radio button blueprint in the Salesforce Lightning Design System (SLDS). The radio button adapts to SLDS 1 or SLDS 2 styling based on the org's theme or the container app that you use.
| | SLDS 1 | SLDS 2 |
| :------------- | :------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------- |
| **Design** | [Radio Button](https://v1.lightningdesignsystem.com/components/radio-group/) | [Radio Button](https://www.lightningdesignsystem.com/components/radio-group/) |
| **For Use In** | Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline | [Lightning Experience](https://help.salesforce.com/s/articleView?id=xcloud.customize_ui_enhancedlex.htm&type=5) |
## Usage
This example creates a radio button group with two options and `option1` is selected
by default. One radio button must be selected as the `required` attribute is
specified.
```html
```
You can check which values are selected by using the `value` attribute.
To retrieve the values when the selection is changed, use the `onchange` event handler and call
`event.detail.value`.
```javascript
import { LightningElement } from "lwc";
export default class MyComponentName extends LightningElement {
options = [
{ label: "Ross", value: "option1" },
{ label: "Rachel", value: "option2" },
];
// Select option1 by default
value = "option1";
handleChange(event) {
const selectedOption = event.detail.value;
console.log("Option selected with value: " + selectedOption);
}
}
```
To create radio buttons, pass in these properties to the `options` attribute.
| Property | Type | Description |
| -------- | ------ | ------------------------------------------------------------------ |
| label | string | The text that displays next to a radio button. |
| value | string | The string that's used to identify which radio button is selected. |
## Input Validation
A radio group that's disabled is always valid. If the radio group is marked required and no option is selected, after you remove focus from the radio group an error message is displayed.
You can override the default message using `message-when-value-missing` when a radio group is required and no option is selected. This message is displayed when you remove focus from the radio group.
```html
```
To programmatically display error messages on invalid fields, use the `reportValidity()` method. This method returns false if the input is invalid.
For custom error messages, display the message using `setCustomValidity()` and `reportValidity()`. For more information, see the [lightning-input](/docs/platform/lightning-component-reference/guide/lightning-input.html) documentation.
```javascript
import { LightningElement } from 'lwc';
export default class ValidationExample extends LightningElement {
value = '';
get options() {
return [
{ label: 'Yes', value: 'yes' },
{ label: 'No', value: 'no' },
];
}
handleSubmit(e) {
const allValid = this.refs.radiogroup.reportValidity();
if (!allValid) {
e.preventDefault();
this.refs.radiogroup.setCustomValidity("Please select an option");
this.refs.radiogroup.showHelpMessageIfInvalid();
}
}
```
If you're creating a form for Salesforce record data, we recommend using [`lightning-record-form`](/docs/platform/lightning-component-reference/guide/lightning-record-form.html), [`lightning-record-edit-form`](/docs/platform/lightning-component-reference/guide/lightning-record-edit-form.html), or [`lightning-record-view-form`](/docs/platform/lightning-component-reference/guide/lightning-record-view-form.html). The record form components are automatically wired up to your record data, labels, and field-level help text. For more information, see [Work with Records Using Base Components](https://developer.salesforce.com/docs/platform/lwc/guide/data-get-user-input-intro).
## Use Multiple Radio Groups on a Page
If multiple `lightning-radio-group` instances on a page or across Salesforce app console tabs share a `name` attribute, their rendered `
` elements also share the same selection scope. Selecting an option in any single group clears active selections in the remaining groups.
To keep radio group selections independent on the same page or across tabs, choose one of these approaches:
- Omit the `name` attribute to enable the component to automatically generate a unique name on each instance.
- Enclose each `lightning-radio-group` component in a `