# Salesforce Lightning TypeScript Types

Public type definitions for packages exposed on the Salesforce Lightning platform.

## Installation

First, install the package using your preferred package manager.

```sh
npm install @salesforce/lightning-types
# OR
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`](https://www.typescriptlang.org/tsconfig/).

```jsonc
{
  "compilerOptions": {
    // ...
  },
  "include": ["src", "types"],
}
```

Now you can import Salesforce Lightning TypeScript types!

<!-- TODO: Add LBC to repo or update example -->

```ts
import LightningInput from "lightning/input";
```

### Installing peer dependencies

Some modules available on the platform are also publicly available via npm (for example, [`lwc`](https://npmjs.com/package/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 lwc
# OR
yarn add @salesforce/lightning-types @salesforce/i18n lwc
```

## List of Modules

Type definitions for the following modules are included in this package.

<!-- START GENERATED MODULE LIST -- DO NOT EDIT -->

| 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`.                                                                                                                                                                                                                       |
| @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 `experience/cmsDeliveryApi` module provides content available to the community.                                                                                                                                                                                                                                             |
| lightning/alert                                | The `lightning/alert` module lets you create an alert modal within your component.                                                                                                                                                                                                                                              |
| lightning/analyticsWaveApi                     | The `lightning/analyticsWaveApi` module includes wire adapters and methods to work with CRM Analytics APIs.                                                                                                                                                                                                                     |
| lightning/avatar                               | The `lightning/avatar` component represents a visual representation of an object, such as a user or account.                                                                                                                                                                                                                    |
| lightning/badge                                | The `lightning/badge` is a label that holds small amounts of information.                                                                                                                                                                                                                                                       |
| lightning/barcodeScanner                       | The `lightning/barcodeScanner` component scans barcodes on a mobile device.                                                                                                                                                                                                                                                     |
| lightning/breadcrumb                           | The `lightning/breadcrumb` component displays the path of a page relative to a parent page.                                                                                                                                                                                                                                     |
| lightning/button                               | The `lightning/button` is a component that represents a button element that executes an action.                                                                                                                                                                                                                                 |
| lightning/buttonIcon                           | The `lightning/buttonIcon` component displays an icon-only button.                                                                                                                                                                                                                                                              |
| lightning/buttonIconStateful                   | The `lightning/buttonIconStateful` component displays an icon-only button.                                                                                                                                                                                                                                                      |
| lightning/buttonStateful                       | The `lightning/buttonStateful` component displays an icon-only button.                                                                                                                                                                                                                                                          |
| lightning/card                                 | The `lightning/card` is used to apply a stylized container around a grouping of information.                                                                                                                                                                                                                                    |
| lightning/carousel                             | The `lightning/carousel` 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                        | The `lightning/carouselImage` component specifies an image used in lightning-carousel, including description and title.                                                                                                                                                                                                         |
| lightning/checkboxGroup                        | The `lightning/checkboxGroup` component represents a checkbox group that enables selection of single or multiple options.                                                                                                                                                                                                       |
| lightning/cmsDeliveryApi                       | The `lightning/cmsDeliveryApi` module provides content available to the community.                                                                                                                                                                                                                                              |
| lightning/combobox                             | The `lightning/combobox` component represents a widget that provides an input field that is readonly, accompanied by a dropdown list of selectable options.                                                                                                                                                                     |
| lightning/confirm                              | The `lightning/confirm` module lets you create a confirm modal within your component.                                                                                                                                                                                                                                           |
| lightning/datatable                            | The `lightning/datatable` 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                          | The `lightning/dualListbox` component represents two side-by-side listboxes.                                                                                                                                                                                                                                                    |
| lightning/fileUpload                           | The `lightning/fileUpload` component provides an integrated way for users to upload multiple files.                                                                                                                                                                                                                             |
| lightning/formattedAddress                     | The `lightning/formattedAddress` component displays a formatted address with optional map integration.                                                                                                                                                                                                                          |
| lightning/formattedDateTime                    | The `lightning/formattedDateTime` component displays a formatted date and time according to the user's locale and formatting options.                                                                                                                                                                                           |
| lightning/formattedEmail                       | The `lightning/formattedEmail` component displays an email as a hyperlink with the mailto: URL scheme.                                                                                                                                                                                                                          |
| lightning/formattedLocation                    | The `lightning/formattedLocation` component displays a read-only representation of a latitude and longitude value.                                                                                                                                                                                                              |
| lightning/formattedName                        | The `lightning/formattedName` component displays a formatted name that can include a salutation and suffix.                                                                                                                                                                                                                     |
| lightning/formattedNumber                      | The `lightning/formattedNumber` component displays formatted numbers for decimals, currency, and percentages.                                                                                                                                                                                                                   |
| lightning/formattedPhone                       | The `lightning/formattedPhone` component displays a phone number as a hyperlink with the tel: URL scheme.                                                                                                                                                                                                                       |
| lightning/formattedRichText                    | The `lightning/formatted-rich-text` component displays rich text content.                                                                                                                                                                                                                                                       |
| lightning/formattedText                        | The `lightning/formattedText` component displays text with formatting options.                                                                                                                                                                                                                                                  |
| lightning/formattedTime                        | The `lightning/formattedTime` component displays a read-only representation of time in the user's locale format.                                                                                                                                                                                                                |
| lightning/formattedUrl                         | The `lightning/formatted-url` component displays a URL as a hyperlink.                                                                                                                                                                                                                                                          |
| lightning/icon                                 | The `lightning/icon` displays an icon from the Salesforce Lightning Design System or a custom image.                                                                                                                                                                                                                            |
| lightning/industriesEducationPublicApi         | The `lightning/industriesEducationPublicApi` module includes APIs to create Constituent Role and update Benefit Assignment records.                                                                                                                                                                                             |
| lightning/input                                | The `lightning/input` component creates an HTML <input> element.                                                                                                                                                                                                                                                                |
| lightning/inputAddress                         | The `lightning/inputAddress` component represents an address compound field, allowing users to enter and edit address information in a structured format.                                                                                                                                                                       |
| lightning/inputField                           | The `lightning/inputField` component represents an editable input for a Salesforce object field.                                                                                                                                                                                                                                |
| lightning/inputlocation                        | The `lightning/inputLocation` component represents a geolocation compound field that accepts a latitude and longitude value.                                                                                                                                                                                                    |
| lightning/inputName                            | The `lightning/inputName` component represents a name compound field.                                                                                                                                                                                                                                                           |
| lightning/inputRichText                        | The `lightning/inputRichText` component provides a WYSIWYG editor with a customizable toolbar for entering rich text.                                                                                                                                                                                                           |
| lightning/layout                               | The `lightning/layout` component is a flexible grid system for arranging containers within a page or inside another container.                                                                                                                                                                                                  |
| lightning/layoutItem                           | The `lightning/layoutItem` defines content to display within lightning-layout.                                                                                                                                                                                                                                                  |
| lightning/lightningVerticalNavigation          | The `lightningVerticalNavigation` component represents a vertical navigation menu.                                                                                                                                                                                                                                              |
| lightning/lightningVerticalNavigationItemBadge | The `lightning/lightningVerticalNavigationItemBadge` component represents a vertical navigation item with a badge.                                                                                                                                                                                                              |
| lightning/logger                               | Logs the event data from the component.                                                                                                                                                                                                                                                                                         |
| lightning/map                                  | The `lightning/map` component displays a map with markers for one or more locations.                                                                                                                                                                                                                                            |
| 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 `lightning/modal` component displays a dialog that focuses the user's attention on a single task or piece of information.                                                                                                                                                                                                   |
| lightning/modalHeader                          | The `lightning/modalHeader` component creates a header to display the heading and tagline at the top of a modal.                                                                                                                                                                                                                |
| lightning/outputField                          | The `lightning/outputField` component represents a read-only display of a label, help text, and value for a field on a Salesforce object.                                                                                                                                                                                       |
| lightning/platformResourceLoader               | The `lightning/platformResourceLoader` component loads resources from the Salesforce platform.                                                                                                                                                                                                                                  |
| lightning/progressBar                          | The `lightning/progressBar` component displays a horizontal or circular progress bar.                                                                                                                                                                                                                                           |
| lightning/progressIndicator                    | The `lightning/progressIndicator` component displays a sequence of steps in a process, such as a multi-step form.                                                                                                                                                                                                               |
| lightning/progressRing                         | The `lightning/progressRing` component displays a circular progress ring to indicate progress.                                                                                                                                                                                                                                  |
| lightning/progressStep                         | The `lightning/progressStep` component represents a single step in a progress indicator.                                                                                                                                                                                                                                        |
| lightning/prompt                               | The `lightning/prompt` module lets you create a prompt modal within your component.                                                                                                                                                                                                                                             |
| lightning/radioGroup                           | The `lightning/radioGroup` component represents a group of radio buttons that permit only one button to be selected at a time.                                                                                                                                                                                                  |
| lightning/recordEditForm                       | The `lightning/recordEditForm` component creates an editable form for a Salesforce record, supporting create and update operations.                                                                                                                                                                                             |
| lightning/recordForm                           | The `lightning/recordForm` component to quickly create forms to add, view, or update a record.                                                                                                                                                                                                                                  |
| lightning/recordViewForm                       | The `lightning/recordViewForm` component to create a form that displays Salesforce record data for specified fields associated with that record.                                                                                                                                                                                |
| lightning/select                               | The `lightning/select` module lets you create a menu of options for single or multiple selection.                                                                                                                                                                                                                               |
| lightning/serviceKnowledgeApi                  | Work with view count statistics for knowledge articles.                                                                                                                                                                                                                                                                         |
| lightning/spinner                              | The `lightning/spinner` displays an animated spinner image to indicate that a feature is loading.                                                                                                                                                                                                                               |
| lightning/tab                                  | The `lightning/tab` keeps related content in a single container. The tab content displays when a user clicks the tab.                                                                                                                                                                                                           |
| lightning/tabset                               | The `lightning/tabset` displays a tabbed container with multiple content areas, only one of which is visible at a time.                                                                                                                                                                                                         |
| lightning/textarea                             | The `lightning/textarea` component represents a multiline text input field.                                                                                                                                                                                                                                                     |
| lightning/toast                                | The `lightning/toast` component represents a notification element used to convey a label.                                                                                                                                                                                                                                       |
| lightning/toast-container                      | The `lightning/toast-container` component represents a container for displaying toast notifications.                                                                                                                                                                                                                            |
| lightning/tree                                 | The `lightning/tree` component displays a nested tree.                                                                                                                                                                                                                                                                          |
| lightning/treeGrid                             | The `lightning/treeGrid` component displays hierarchical data in a table with expandable rows.                                                                                                                                                                                                                                  |
| lightning/treeItem                             | The `lightning/treeItem` component represents an item in a tree structure.                                                                                                                                                                                                                                                      |
| lightning/userConsentCookie                    | The `userConsentCookie` provides utility functions that enable you to incorporate the Cookie Consent mechanism in your components.                                                                                                                                                                                              |
| lightning/verticalNavigationItem               | The `lightning/verticalNavigationItem` represents an item in a vertical navigation menu.                                                                                                                                                                                                                                        |
| lightning/verticalNavigationItemIcon           | The `lightning/verticalNavigationItemIcon` represents a navigation item with an icon in a vertical navigation menu.                                                                                                                                                                                                             |
| lwc                                            | The Lightning Web Components UI framework                                                                                                                                                                                                                                                                                       |

<!-- END GENERATED MODULE LIST -->

## Bug Reports

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](https://salesforce.stackexchange.com/) or open a
[Salesforce case](https://help.salesforce.com/s/).

## Security

Please report any security issue to [security@salesforce.com](mailto: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.

## License

All rights reserved. See the license in `LICENSE.txt` for details.
