Skip to main content
rule official · GitHub

pcf-canvas-apps — GitHub Copilot rule: what it does, how to install

Sets GitHub Copilot context for creating PCF controls in canvas apps. Helps handle manifest versioning, security warnings, and environment requirements.

Install into GitHub Copilot · Manually: put the files in place All methods and platforms ↓
.github/instructions/pcf-canvas-apps.instructions.md
Open on GitHub

What pcf-canvas-apps does

This instruction file guides GitHub Copilot when working with the Power Apps component framework. It activates for .ts, .tsx, .js, .json, .xml, .pcfproj, and .csproj files. Copilot uses it to follow CLI workflows and packaging requirements for canvas applications.

Activating code components requires a Power Apps license alongside system administrator privileges. The setting resides in the Power Apps Admin Center under product features. Model-driven apps have this enabled out of the box, but canvas environments need manual activation.

Because controls running inside Power Apps Studio access security tokens, importing untrusted solutions introduces direct data exposure risks. Runtime updates also demand care. Simply deleting and re-adding a control will not update it; you must increment the version field in the manifest and reopen the app.

What it helps with

  • handle Power Apps Studio security constraints for custom controls
  • update manifest versioning so canvas apps load modified code
  • configure component framework settings in the Power Platform Admin Center
  • structure TypeScript and .pcfproj files for Microsoft Dataverse solutions

Example prompts for the agent

  • Help me configure properties in this PCF manifest for a canvas app
  • Why isn't Power Apps Studio picking up my code changes after rebuilding?
  • Review this component manifest against Power Apps Studio security rules

How to install pcf-canvas-apps

Manually: put the files in place

.github/instructions/pcf-canvas-apps.instructions.md

The applyTo field sets which files it applies to

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about pcf-canvas-apps

How to install pcf-canvas-apps in GitHub Copilot?

Save the instruction file to .github/instructions/pcf-canvas-apps.instructions.md in your project root. Copilot reads these instructions when you edit related source files.

What does pcf-canvas-apps do?

It gives Copilot background rules for developing code components for canvas apps. The file covers CLI commands, manifest structure, security checks, and solution import.

Why are component changes not showing up in canvas apps?

You must increment the version attribute in your control manifest file. Reopening the app in Power Apps Studio triggers the update prompt; re-adding the control without a version bump does nothing.

Source text

pcf-canvas-apps.instructions.md · MIT
---
description: 'Code components for canvas apps implementation, security, and configuration'
applyTo: '**/*.{ts,tsx,js,json,xml,pcfproj,csproj}'
---

# Code Components for Canvas Apps

Professional developers can use Power Apps component framework to create code components that can be used in their canvas apps. App makers can use Power Apps component framework to create, import, and add code components to canvas apps using [Microsoft Power Platform CLI](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/get-powerapps-cli).

> **Note**: Certain APIs might not be available in canvas apps. We recommend that you check each API to determine where it's available.

## Security Considerations

> **Warning**: Code components contain code that may not be generated by Microsoft and can potentially access security tokens and data when rendered in Power Apps Studio. When adding code components to a canvas app, make sure that the code component solutions are from a trusted source. This vulnerability does not exist when playing the canvas app.

### Security Warning in Power Apps Studio

When you open a canvas app that contains code components in Power Apps Studio, a warning message about potentially unsafe code appears. Code components in the Power Apps Studio environment have access to security tokens; hence only components from trusted sources should be opened.

**Best Practices:**
- Administrators and system customizers should review and validate all code components before importing them into an environment
- Make components available to makers only after validation
- The `Default` publisher is shown when you import code components by using an unmanaged solution or when you have used `pac pcf push` to install your code component

![Safety warning](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/media/canvas-app-safety-warning.png)

## Prerequisites

- A Power Apps license is required. More information: [Power Apps component framework licensing](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/overview#licensing)
- System administrator privileges are required to enable the Power Apps component framework feature in the environment

## Enable the Power Apps Component Framework Feature

To add code components to an app, you need to enable the Power Apps component framework feature in each environment where you want to use them. By default, the Power Apps component feature is enabled for model-driven apps.

### Steps to Enable for Canvas Apps:

1. Sign in to [Power Apps](https://powerapps.microsoft.com/)
2. Select **Settings** ![Settings](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/media/settings.png), and then select **Admin Center**

   ![Settings and Admin Center](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/media/select-admin-center-from-settings.png)

3. On the left pane, select **Environments**, select the environment where you want to enable this feature, and then select **Settings**
4. Expand **Product**, and select **Features**
5. From the list of available features, turn on **Power Apps component framework for canvas apps**, and then select **Save**

   ![Enable Power Apps component framework](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/media/enable-pcf-feature.png)

## Implementing Code Components

After you enable the Power Apps component framework feature in your environment, you can start implementing the logic for code components. For a step-by-step tutorial, go to [Create your first code component](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/implementing-controls-using-typescript).

**Recommendation**: Check the [limitations](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/limitations) of code components in canvas apps before starting implementation.

## Add Components to a Canvas App

1. Go to Power Apps Studio
2. Create a new canvas app, or edit an existing app to which you want to add the code component

   > **Important**: Make sure the solution .zip file containing the code components has already been [imported](https://learn.microsoft.com/en-us/power-apps/maker/data-platform/import-update-export-solutions) into Microsoft Dataverse before you proceed to the next step.

3. On the left pane, select **Add (+)**, and then select **Get more components**

   ![Insert components](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/media/insert-code-components-using-get-more-components.png)

4. Select the **Code** tab, select a component from the list, and then select **Import**

   ![Import a component](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/media/insert-component-add-sample-component.png)

5. On the left pane, select **+**, expand **Code components**, and then select the component to add it to the app

   ![Add a component](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/media/add-sample-component-from-list.png)

> **Note**: You can also add components by selecting **Insert > Custom > Import component**. This option will be removed in a future release, so we suggest using the flow described above.

### Component Properties

On the Properties tab, you'll notice the code component properties are displayed.

![Default code component properties pane](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/media/property-pane-with-parameters.png)

> **Note**: Existing code components can be re-imported by updating the code component's manifest version if you want the properties to be available in the default Properties tab. As before, the properties will continue to be available on the Advanced properties tab.

## Delete a Code Component from a Canvas App

1. Open the app where you've added the code component
2. On the left pane, select **Tree view**, and then select the screen where you've added the code component
3. Next to the component, select **More (...)**, and then select **Delete**

   ![Delete a code component](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/media/delete-code-component.png)

4. Save the app to see the changes

## Update Existing Code Components

Whenever you update the code components and want to see the runtime changes, you need to change the `version` property in the manifest file. We recommend that you change the version of the component whenever you make changes.

> **Note**: Existing code components are updated only when the app is closed or reopened in Power Apps Studio. When you reopen the app, it asks you to update the code components. Simply deleting or adding code components back into the app won't update the components. Publish all the customizations in the updated solution first, otherwise updates made to the code component won't appear.

## See Also

- [Power Apps component framework overview](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/overview)
- [Create your first code component](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/implementing-controls-using-typescript)
- [Learn Power Apps component framework](https://learn.microsoft.com/en-us/training/paths/use-power-apps-component-framework)

© github · MIT · github/awesome-copilot

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set861

The whole set →
pcf-events A rule that tells Copilot how to declare and handle custom events in Power Apps Component Framework components. ★ 40,418repo stars pcf-dependent-libraries Guides GitHub Copilot in configuring shared prebuilt libraries for Power Apps Component Framework (PCF) components to avoid bundling duplicates. ★ 40,418repo stars pcf-community-resources Find PCF component examples, learning videos, developer blogs, and builder tools in one guide. Use it when you need a starting point or help with PCF development. ★ 40,418repo stars pcf-code-components A rule that teaches Copilot how Power Apps code components are built: manifest, TypeScript implementation, resources. Useful when editing ControlManifest.Input.xml or index.ts. ★ 40,418repo stars pcf-best-practices This rule guides Copilot through PCF component lifecycle, API use, and host-specific constraints. Use it when building or changing components for canvas or model-driven apps. ★ 40,418repo stars oop-design-patterns A GitHub Copilot rule that steers code generation and refactoring toward GoF design patterns and SOLID principles in object-oriented code. ★ 40,418repo stars no-heredoc A rule that stops the agent from writing files through terminal heredocs and redirections, because those commands corrupt content in VS Code. ★ 40,418repo stars nestjs This rule feeds GitHub Copilot a set of NestJS conventions: modules, DI, DTOs and validation. Useful when the agent writes TypeScript server code. ★ 40,418repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor