Type definitions for working with Salesforce Lightning.
Public type definitions for packages exposed on the Salesforce Lightning platform.
First, install the package using your preferred package manager.
``sh`
npm install @salesforce/lightning-typesOR
yarn add @salesforce/lightning-types
Next, import the package once, from any TypeScript file in your project. For example, if you have a
types directory, you may create a file called salesforce.d.ts.
`ts`
// types/salesforce.d.ts
import "@salesforce/lightning-types";
Lastly, ensure that the file with the import is included in your tsconfig.json.
`jsonc`
{
"compilerOptions": {
// ...
},
"include": ["src", "types"],
}
Now you can import Salesforce Lightning TypeScript types!
`ts`
import LightningInput from "lightning/input";
Some modules available on the platform are also publicly available via npm (for example, lwc). To ensure maximum compatibility with your project, they are listed in @salesforce/lightning-types as peer dependencies. However, not all package managers automatically install peer dependencies. To ensure all types are available in your project, you may need to to explicitly install the peer dependencies.
`sh`
npm install @salesforce/lightning-types @salesforce/i18n lwcOR
yarn add @salesforce/lightning-types @salesforce/i18n lwc
Type definitions for the following modules are included in this package.
| Module | Description |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| @salesforce/client/formFactor | Access the form factor of the hardware the browser is running on. |
| @salesforce/community/basePath | Get the section of the site’s URL that comes after the domain. |
| @salesforce/community/Id | Get the ID of the network part of the site for eg., import the ID to pass as a parameter to an API. |
| @salesforce/i18n | Access internationalization properties |
| @salesforce/label/\* | Import custom labels. The name of the label being imported should be in the format namespace.labelName. |experience/cmsDeliveryApi
| @salesforce/lds-default-luvio | Lightning Data Service default Luvio adapter |
| @salesforce/site/activeLanguages | The list of active languages in your Experience Builder site. |
| @salesforce/site/Id | Get the current Experience Builder site Id. |
| @salesforce/user/Id | Get the current user's ID. |
| @salesforce/user/isGuest | Identify whether the current user is a guest or not. |
| experience/cmsDeliveryApi | The module provides content available to the community. |lightning/alert
| lightning/alert | The module lets you create an alert modal within your component. |lightning/analyticsWaveApi
| lightning/analyticsWaveApi | The module includes wire adapters and methods to work with CRM Analytics APIs. |lightning/avatar
| lightning/avatar | The component represents a visual representation of an object, such as a user or account. |lightning/badge
| lightning/badge | The is a label that holds small amounts of information. |lightning/barcodeScanner
| lightning/barcodeScanner | The component scans barcodes on a mobile device. |lightning/breadcrumb
| lightning/breadcrumb | The component displays the path of a page relative to a parent page. |lightning/button
| lightning/button | The is a component that represents a button element that executes an action. |lightning/buttonIcon
| lightning/buttonIcon | The component displays an icon-only button. |lightning/buttonIconStateful
| lightning/buttonIconStateful | The component displays an icon-only button. |lightning/buttonStateful
| lightning/buttonStateful | The component displays an icon-only button. |lightning/card
| lightning/card | The is used to apply a stylized container around a grouping of information. |lightning/carousel
| lightning/carousel | The component displays a collection of images that are displayed one at a time. This component accepts up to 5 lightning-carousel-image components in its default slot. |lightning/carouselImage
| lightning/carouselImage | The component specifies an image used in lightning-carousel, including description and title. |lightning/checkboxGroup
| lightning/checkboxGroup | The component represents a checkbox group that enables selection of single or multiple options. |lightning/cmsDeliveryApi
| lightning/cmsDeliveryApi | The module provides content available to the community. |lightning/combobox
| lightning/combobox | The component represents a widget that provides an input field that is readonly, accompanied by a dropdown list of selectable options. |lightning/confirm
| lightning/confirm | The module lets you create a confirm modal within your component. |lightning/datatable
| lightning/datatable | The component displays tabular data where each column can be displayed based on the data type. It provides features like sorting, row selection, inline editing, infinite scrolling, and more. |lightning/dualListbox
| lightning/dualListbox | The component represents two side-by-side listboxes. |lightning/fileUpload
| lightning/fileUpload | The component provides an integrated way for users to upload multiple files. |lightning/formattedAddress
| lightning/formattedAddress | The component displays a formatted address with optional map integration. |lightning/formattedDateTime
| lightning/formattedDateTime | The component displays a formatted date and time according to the user's locale and formatting options. |lightning/formattedEmail
| lightning/formattedEmail | The component displays an email as a hyperlink with the mailto: URL scheme. |lightning/formattedLocation
| lightning/formattedLocation | The component displays a read-only representation of a latitude and longitude value. |lightning/formattedName
| lightning/formattedName | The component displays a formatted name that can include a salutation and suffix. |lightning/formattedNumber
| lightning/formattedNumber | The component displays formatted numbers for decimals, currency, and percentages. |lightning/formattedPhone
| lightning/formattedPhone | The component displays a phone number as a hyperlink with the tel: URL scheme. |lightning/formatted-rich-text
| lightning/formattedRichText | The component displays rich text content. |lightning/formattedText
| lightning/formattedText | The component displays text with formatting options. |lightning/formattedTime
| lightning/formattedTime | The component displays a read-only representation of time in the user's locale format. |lightning/formatted-url
| lightning/formattedUrl | The component displays a URL as a hyperlink. |lightning/icon
| lightning/icon | The displays an icon from the Salesforce Lightning Design System or a custom image. |lightning/industriesEducationPublicApi
| lightning/industriesEducationPublicApi | The module includes APIs to create Constituent Role and update Benefit Assignment records. |lightning/input
| lightning/input | The component creates an HTML element. |lightning/inputAddress
| lightning/inputAddress | The component represents an address compound field, allowing users to enter and edit address information in a structured format. |lightning/inputField
| lightning/inputField | The component represents an editable input for a Salesforce object field. |lightning/inputLocation
| lightning/inputlocation | The component represents a geolocation compound field that accepts a latitude and longitude value. |lightning/inputName
| lightning/inputName | The component represents a name compound field. |lightning/inputRichText
| lightning/inputRichText | The component provides a WYSIWYG editor with a customizable toolbar for entering rich text. |lightning/layout
| lightning/layout | The component is a flexible grid system for arranging containers within a page or inside another container. |lightning/layoutItem
| lightning/layoutItem | The defines content to display within lightning-layout. |lightningVerticalNavigation
| lightning/lightningVerticalNavigation | The component represents a vertical navigation menu. |lightning/lightningVerticalNavigationItemBadge
| lightning/lightningVerticalNavigationItemBadge | The component represents a vertical navigation item with a badge. |lightning/map
| lightning/logger | Logs the event data from the component. |
| lightning/map | The component displays a map with markers for one or more locations. |lightning/modal
| lightning/mobileCapabilities | Mobile capabilities are JavaScript APIs that make mobile hardware and platform (operating system) features available in JavaScript. They require access to device hardware, platform APIs, or both. Mobile capability APIs are available only when a Lightning web component runs in a supported mobile app on a mobile device. |
| lightning/modal | The component displays a dialog that focuses the user's attention on a single task or piece of information. |lightning/modalHeader
| lightning/modalHeader | The component creates a header to display the heading and tagline at the top of a modal. |lightning/outputField
| lightning/outputField | The component represents a read-only display of a label, help text, and value for a field on a Salesforce object. |lightning/platformResourceLoader
| lightning/platformResourceLoader | The component loads resources from the Salesforce platform. |lightning/progressBar
| lightning/progressBar | The component displays a horizontal or circular progress bar. |lightning/progressIndicator
| lightning/progressIndicator | The component displays a sequence of steps in a process, such as a multi-step form. |lightning/progressRing
| lightning/progressRing | The component displays a circular progress ring to indicate progress. |lightning/progressStep
| lightning/progressStep | The component represents a single step in a progress indicator. |lightning/prompt
| lightning/prompt | The module lets you create a prompt modal within your component. |lightning/radioGroup
| lightning/radioGroup | The component represents a group of radio buttons that permit only one button to be selected at a time. |lightning/recordEditForm
| lightning/recordEditForm | The component creates an editable form for a Salesforce record, supporting create and update operations. |lightning/recordForm
| lightning/recordForm | The component to quickly create forms to add, view, or update a record. |lightning/recordViewForm
| lightning/recordViewForm | The component to create a form that displays Salesforce record data for specified fields associated with that record. |lightning/select
| lightning/select | The module lets you create a menu of options for single or multiple selection. |lightning/spinner
| lightning/serviceKnowledgeApi | Work with view count statistics for knowledge articles. |
| lightning/spinner | The displays an animated spinner image to indicate that a feature is loading. |lightning/tab
| lightning/tab | The keeps related content in a single container. The tab content displays when a user clicks the tab. |lightning/tabset
| lightning/tabset | The displays a tabbed container with multiple content areas, only one of which is visible at a time. |lightning/textarea
| lightning/textarea | The component represents a multiline text input field. |lightning/toast
| lightning/toast | The component represents a notification element used to convey a label. |lightning/toast-container
| lightning/toast-container | The component represents a container for displaying toast notifications. |lightning/tree
| lightning/tree | The component displays a nested tree. |lightning/treeGrid
| lightning/treeGrid | The component displays hierarchical data in a table with expandable rows. |lightning/treeItem
| lightning/treeItem | The component represents an item in a tree structure. |userConsentCookie
| lightning/userConsentCookie | The provides utility functions that enable you to incorporate the Cookie Consent mechanism in your components. |lightning/verticalNavigationItem
| lightning/verticalNavigationItem | The represents an item in a vertical navigation menu. |lightning/verticalNavigationItemIcon
| lightning/verticalNavigationItemIcon | The represents a navigation item with an icon in a vertical navigation menu. |
| lwc | The Lightning Web Components UI framework |
This package solely contains TypeScript type definitions; it is not responsible for the behavior of
the APIs it documents. If you encounter any issues, you may post on
Salesforce Stack Exchange or open a
Salesforce case.
Please report any security issue to security@salesforce.com
as soon as it is discovered. This library limits its runtime dependencies in
order to reduce the total cost of ownership as much as can be, but all consumers
should remain vigilant and have their security stakeholders review all third-party
products (3PP) like this one and their dependencies.
All rights reserved. See the license in LICENSE.txt` for details.