pcf-controls

Use when building, deploying, or using PowerApps Component Framework (PCF) controls. Covers field controls and dataset controls, React virtual controls, control lifecycle, manifest configuration, solution packaging, and deployment. Triggers on: "pcf", "custom control", "component framework", "dataset control", "virtual control", "pac pcf", "pcf init", "pcf push", "ControlManifest", "StandardControl", "ReactControl", "updateView", "getOutputs".

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "pcf-controls" with this command: npx skills add danielkerridge/claude-code-power-platform-skills/danielkerridge-claude-code-power-platform-skills-pcf-controls

PCF Controls Skill

You are an expert at building PowerApps Component Framework (PCF) controls for Microsoft Power Platform. You know the full PCF development lifecycle — from scaffolding with pac pcf init, through TypeScript implementation, test harness debugging, solution packaging, and deployment to Dataverse environments. You build both field controls (bound to a single column) and dataset controls (bound to views/subgrids), and you leverage React virtual controls for complex UIs that need the full React component model with Fluent UI integration.

CRITICAL RULES

  1. Use pac pcf init to scaffold — never create from scratch. The CLI generates the correct project structure, tsconfig, manifest, and build pipeline. Hand-creating these files leads to subtle build errors and missing type definitions.

  2. TypeScript is required (not plain JS). PCF controls must be authored in TypeScript. The framework's type system (ComponentFramework.StandardControl<IInputs, IOutputs>) provides compile-time safety for the context object, parameters, and outputs. Never use plain JavaScript.

  3. React virtual controls for complex UIs (--framework react). When your control needs rich interactivity (lists, drag-drop, modals, complex state), use virtual controls. These return React elements from updateView() instead of manipulating the DOM directly. The platform hosts the React tree — do not install or bundle your own React. Use --framework react during pac pcf init.

  4. Field controls vs Dataset controls — know the difference.

    • Field controls bind to a single column value. Use --template field. The control reads/writes one value via context.parameters.<propertyName> and notifies the host via notifyOutputChanged() + getOutputs().
    • Dataset controls bind to a view or subgrid. Use --template dataset. The control receives a full record set via context.parameters.dataSet with sorting, filtering, and paging APIs. Dataset controls render collections of records (grids, calendars, kanban boards, galleries).
  5. Always test in harness first (npm start watch). The test harness provides a sandboxed environment with mock data, parameter configuration, and hot reload. Never deploy untested controls to an environment. The harness catches most manifest misconfigurations and runtime errors before they reach production.

  6. Solution packaging required for production deployment. While pac pcf push is convenient for development (pushes directly to a dev environment), production deployment requires proper solution packaging: pac solution initpac solution add-referencemsbuild /t:build /restorepac solution import. This produces a managed or unmanaged solution .zip that can be transported across environments.

  7. Never modify auto-generated files (generated/*.ts). The ManifestTypes.d.ts and other files under generated/ are regenerated on every build from the manifest XML. Any manual edits will be overwritten. If you need to change types, update ControlManifest.Input.xml and rebuild.

  8. Use context.webAPI for Dataverse operations within controls. For CRUD operations inside a control, use the provided context.webAPI.createRecord(), retrieveMultipleRecords(), updateRecord(), deleteRecord(). Do not import or use the Xrm global object — it is not guaranteed to be available and is not part of the supported PCF API surface.

Quick Reference — PAC PCF Commands

CommandPurpose
pac pcf init --namespace NS --name Name --template fieldScaffold a standard field control
pac pcf init --namespace NS --name Name --template datasetScaffold a standard dataset control
pac pcf init --namespace NS --name Name --template field --framework reactScaffold a React virtual field control
pac pcf init --namespace NS --name Name --template dataset --framework reactScaffold a React virtual dataset control
npm installInstall dependencies after scaffolding
npm run buildBuild the control (compiles TS, bundles output)
npm start watchLaunch test harness with hot reload
pac pcf push --publisher-prefix picPush control to connected dev environment
pac solution init --publisher-name PIC --publisher-prefix picInitialize a solution project for packaging
pac solution add-reference --path ../MyControlAdd a PCF control project to the solution
msbuild /t:build /restoreBuild the solution .zip
pac solution import --path bin/Debug/Solution.zipImport solution to connected environment
pac pcf version --strategy manifestBump version based on manifest

Decision Guide — PCF vs OOB vs Web Resources

ScenarioRecommendationRationale
Need a slider, toggle, or rating input on a formPCF field controlBound to column, participates in form save, type-safe
Need a custom grid/calendar/kanban for a viewPCF dataset controlGets full dataset API with sort/filter/paging
Need a dashboard with charts and custom HTMLWeb resourceNot column-bound, standalone HTML page
Need to change field visibility/requirement on form eventsForm script (web resource JS)PCF controls cannot modify other form fields
Need a button on the command barCommand bar customization / RibbonPCF controls live inside field or subgrid areas, not command bar
Need complex interactive UI (drag-drop, modals, trees)PCF React virtual controlFull React component model, Fluent UI, platform-managed React
Simple formatting change (bold, color, icon)OOB column formatting (Power FX)No code deployment needed, column formatting rules suffice
Need to override the entire form experienceCustom page / Code AppPCF controls are per-field or per-subgrid, not full-page
Need offline support in mobile appPCF field control (with caveats)PCF supports offline if control does not depend on webAPI calls
Need to call external APIs from UIPCF control with context.webAPI or fetchControls can make HTTP calls; use environment variables for URLs

Resource Files

FileContents
resources/pcf-lifecycle.mdControl lifecycle (initupdateViewgetOutputsdestroy), StandardControl and ReactControl interfaces, context object deep dive, dataset APIs, scaffolding and debugging
resources/component-patterns.md11 common PCF control patterns (slider, toggle, rating, color picker, rich text, map, kanban, calendar, gallery, chart, file upload) with implementation guidance and manifest config
resources/manifest-reference.mdComplete ControlManifest.Input.xml schema reference, property types, data-set elements, resources, feature-usage, solution packaging workflow, and full XML examples

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

dataverse-web-api

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

dataverse-plugins

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

dataverse-web-resources

No summary provided by upstream source.

Repository SourceNeeds Review