{"id":13545929,"url":"https://github.com/trailheadapps/lwc-recipes","last_synced_at":"2025-05-13T17:07:15.912Z","repository":{"id":38706255,"uuid":"161633214","full_name":"trailheadapps/lwc-recipes","owner":"trailheadapps","description":"A collection of easy-to-digest code examples for Lightning Web Components on Salesforce Platform","archived":false,"fork":false,"pushed_at":"2025-05-01T21:59:27.000Z","size":5976,"stargazers_count":2704,"open_issues_count":7,"forks_count":3143,"subscribers_count":140,"default_branch":"main","last_synced_at":"2025-05-01T22:33:38.571Z","etag":null,"topics":["apex","jest","lightning-web-components","salesforce"],"latest_commit_sha":null,"homepage":"https://developer.salesforce.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trailheadapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-12-13T12:03:41.000Z","updated_at":"2025-05-01T21:59:30.000Z","dependencies_parsed_at":"2024-01-01T23:53:25.087Z","dependency_job_id":"e9d9de93-e2f8-4f13-8327-747d1cdcea78","html_url":"https://github.com/trailheadapps/lwc-recipes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailheadapps%2Flwc-recipes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailheadapps%2Flwc-recipes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailheadapps%2Flwc-recipes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailheadapps%2Flwc-recipes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trailheadapps","download_url":"https://codeload.github.com/trailheadapps/lwc-recipes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990466,"owners_count":21995774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apex","jest","lightning-web-components","salesforce"],"created_at":"2024-08-01T12:00:27.227Z","updated_at":"2025-10-14T12:10:00.971Z","avatar_url":"https://github.com/trailheadapps.png","language":"JavaScript","funding_links":[],"categories":["Components available","Official Examples"],"sub_categories":[],"readme":"# Lightning Web Components Recipes\n\n[![CI](https://github.com/trailheadapps/lwc-recipes/actions/workflows/ci.yml/badge.svg)](https://github.com/trailheadapps/lwc-recipes/actions/workflows/ci.yml) [![Packaging](https://github.com/trailheadapps/lwc-recipes/actions/workflows/packaging.yml/badge.svg)](https://github.com/trailheadapps/lwc-recipes/actions/workflows/packaging.yml) [![codecov](https://codecov.io/gh/trailheadapps/lwc-recipes/branch/main/graph/badge.svg)](https://codecov.io/gh/trailheadapps/lwc-recipes)\n\n![recipes-logo](recipes-logo.png)\n\nA collection of easy-to-digest code examples for Lightning Web Components. Each recipe demonstrates how to code a specific task in the fewest lines of code possible while following best practices. A \"View Source\" link takes you directly to the code on GitHub. From \"Hello World\" to data access and third-party libraries, there's a recipe for that!\n\n\u003cdiv\u003e\n    \u003cimg src=\"https://res.cloudinary.com/hy4kyit2a/f_auto,fl_lossy,q_70,w_50/learn/projects/quick-start-lwc-recipes-app/bb501c3216ac163958f036fb90357955_badge.png\" align=\"left\" alt=\"Trailhead Badge\"/\u003e\n    Learn more about this app by completing the \u003ca href=\"https://trailhead.salesforce.com/content/learn/projects/quick-start-lwc-recipes-app\"\u003eQuick Start: Explore the LWC Recipes Sample App\u003c/a\u003e Trailhead project or by watching this \u003ca href=\"https://www.youtube.com/watch?v=lK3NOZGc5fg\u0026list=PLgIMQe2PKPSJcuCwM61dEc4jFG_jHqV2t\u0026index=3\"\u003eshort presentation video\u003c/a\u003e.\n    \u003cbr/\u003e\n    \u003cbr/\u003e\n    \u003cbr/\u003e\n\u003c/div\u003e\n\n\u003e This sample application is designed to run on Salesforce Platform. If you want to experience Lightning Web Components on any platform, please visit https://lwc.dev, and try out our Lightning Web Components sample application [LWC Recipes OSS](https://github.com/trailheadapps/lwc-recipes-oss).\n\n## Table of contents\n\n- [Installing the app using a Scratch Org](#installing-the-app-using-a-scratch-org): This is the recommended installation option. Use this option if you are a developer who wants to experience the app and the code.\n\n- [Installing the app using an Unlocked Package](#installing-the-app-using-an-unlocked-package): This option allows anybody to experience the sample app without installing a local development environment.\n\n- [Installing the app using a Developer Edition Org or a Trailhead Playground](#installing-the-app-using-a-developer-edition-org-or-a-trailhead-playground): Useful when tackling Trailhead Badges or if you want the app deployed to a more permanent environment than a Scratch org.\n\n- [Optional installation instructions](#optional-installation-instructions)\n\n- [Code tours](#code-tours)\n\n## Installing the app using a Scratch Org\n\n1. Set up your environment. Follow the steps in the [Quick Start: Lightning Web Components](https://trailhead.salesforce.com/content/learn/projects/quick-start-lightning-web-components/) Trailhead project. The steps include:\n\n    - Enable Dev Hub in your Trailhead Playground\n    - Install Salesforce CLI\n    - Install Visual Studio Code\n    - Install the Visual Studio Code Salesforce extensions, including the Lightning Web Components extension\n\n1. If you haven't already done so, authorize your hub org and provide it with an alias (**myhuborg** in the command below):\n\n    ```\n    sf org login web -d -a myhuborg\n    ```\n\n1. Clone the lwc-recipes repository:\n\n    ```\n    git clone https://github.com/trailheadapps/lwc-recipes\n    cd lwc-recipes\n    ```\n\n1. Create a scratch org and provide it with an alias (**lwc-recipes** in the command below):\n\n    ```\n    sf org create scratch -d -f config/project-scratch-def.json -a lwc-recipes\n    ```\n\n1. Push the app to your scratch org:\n\n    ```\n    sf project deploy start\n    ```\n\n1. Assign the **recipes** permission set to the default user:\n\n    ```\n    sf org assign permset -n recipes\n    ```\n\n1. Import sample data:\n\n    ```\n    sf data tree import -p ./data/data-plan.json\n    ```\n\n1. Open the scratch org:\n\n    ```\n    sf org open\n    ```\n\n1. In **Setup**, under **Themes and Branding**, activate the **Recipes Lite** or **Recipes Blue** theme.\n\n1. In App Launcher, click **View All** then select the **LWC** app.\n\n## Installing the app using an Unlocked Package\n\nFollow this set of instructions if you want to deploy the app to a more permanent environment than a Scratch org or if you don't want to install the local development tools. You can use non source-tracked orgs such as a free [Developer Edition Org](https://developer.salesforce.com/signup) or a [Trailhead Playground](https://trailhead.salesforce.com/).\n\nMake sure to start from a brand-new environment to avoid conflicts with any previous work you may have done.\n\n1. Log in to your org\n\n1. Click [this link](https://login.salesforce.com/packaging/installPackage.apexp?p0=04tKi000000LP9OIAW) to install the Recipes unlocked package in your org.\n\n1. Select **Install for All Users**\n\n1. Import Account and Contacts data:\n\n    - Click [here](https://raw.githubusercontent.com/trailheadapps/lwc-recipes/main/data/Accounts-Contacts.csv) to access the **Accounts-Contacts.csv** file. Right click on the browser window and save the file as **Accounts-Contacts.csv**.\n    - In **Setup**, type **Data Import** in the Quick Find box and click **Data Import Wizard**.\n    - Click **Launch Wizard**.\n    - Click **Accounts and Contacts**, and click **Add New Records**.\n    - Drag the **Accounts-Contacts.csv** file you just saved to the upload area.\n    - Click **Next**, **Next**, and **Start Import**.\n\n1. If you're attempting the [Quick Start](https://trailhead.salesforce.com/en/content/learn/projects/quick-start-lwc-recipes-app) on Trailhead, this step is required, but otherwise, skip:\n\n    - Go to **Setup \u003e Users \u003e Permission Sets**.\n    - Click **recipes**.\n    - Click **Manage Assignments**.\n    - Check your user and click **Add Assignments**.\n\n1. In **Setup**, under **Themes and Branding**, activate the **Recipes Lite** or **Recipes Blue** theme.\n\n1. In App Launcher, click **View All** then select the **LWC Recipes** app.\n\n## Installing the App using a Developer Edition Org or a Trailhead Playground\n\nFollow this set of instructions if you want to deploy the app to a more permanent environment than a Scratch org.\nThis includes non source-tracked orgs such as a [free Developer Edition Org](https://developer.salesforce.com/signup) or a [Trailhead Playground](https://trailhead.salesforce.com/).\n\nMake sure to start from a brand-new environment to avoid conflicts with previous work you may have done.\n\n1. Clone this repository:\n\n    ```\n    git clone https://github.com/trailheadapps/lwc-recipes\n    cd lwc-recipes\n    ```\n\n1. Authorize your Trailhead Playground or Developer org and provide it with an alias (**mydevorg** in the command below):\n\n    ```\n    sf org login web -s -a mydevorg\n    ```\n\n1. Run this command in a terminal to deploy the app.\n\n    ```\n    sf project deploy start -d force-app\n    ```\n\n1. Assign the `recipes` permission set to the default user.\n\n    ```\n    sf org assign permset -n recipes\n    ```\n\n1. Import some sample data.\n\n    ```\n    sf data tree import -p ./data/data-plan.json\n    ```\n\n1. If your org isn't already open, open it now:\n\n    ```\n    sf org open -o mydevorg\n    ```\n\n1. In **Setup**, under **Themes and Branding**, activate the **Recipes Lite** or **Recipes Blue** theme.\n\n1. In App Launcher, select the **LWC** app.\n\n## Optional Installation Instructions\n\nThis repository contains several files that are relevant if you want to integrate modern web development tools into your Salesforce development processes or into your continuous integration/continuous deployment processes.\n\n### Code formatting\n\n[Prettier](https://prettier.io/) is a code formatter used to ensure consistent formatting across your code base. To use Prettier with Visual Studio Code, install [this extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) from the Visual Studio Code Marketplace. The [.prettierignore](/.prettierignore) and [.prettierrc](/.prettierrc) files are provided as part of this repository to control the behavior of the Prettier formatter.\n\n\u003e **Warning**\n\u003e The current Apex Prettier plugin version requires that you install Java 11 or above.\n\n### Code linting\n\n[ESLint](https://eslint.org/) is a popular JavaScript linting tool used to identify stylistic errors and erroneous constructs. To use ESLint with Visual Studio Code, install [this extension](https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode-lwc) from the Visual Studio Code Marketplace. The [.eslintignore](/.eslintignore) file is provided as part of this repository to exclude specific files from the linting process in the context of Lightning Web Components development.\n\n### Pre-commit hook\n\nThis repository also comes with a [package.json](./package.json) file that makes it easy to set up a pre-commit hook that enforces code formatting and linting by running Prettier and ESLint every time you `git commit` changes.\n\nTo set up the formatting and linting pre-commit hook:\n\n1. Install [Node.js](https://nodejs.org) if you haven't already done so\n1. Run `npm install` in your project's root folder to install the ESLint and Prettier modules (Note: Mac users should verify that Xcode command line tools are installed before running this command.)\n\nPrettier and ESLint will now run automatically every time you commit changes. The commit will fail if linting errors are detected. You can also run the formatting and linting from the command line using the following commands (check out [package.json](./package.json) for the full list):\n\n```\nnpm run lint\nnpm run prettier\n```\n\n## Code Tours\n\nCode Tours are guided walkthroughs that will help you understand the app code better. To be able to run them, install the [CodeTour VSCode extension](https://marketplace.visualstudio.com/items?itemName=vsls-contrib.codetour).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailheadapps%2Flwc-recipes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrailheadapps%2Flwc-recipes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailheadapps%2Flwc-recipes/lists"}