Power Apps Component Framework API Reference
Complete PCF API reference with all interfaces and their availability in model-driven and canvas apps
MCP get_skill({ skillId: "power-apps-component-framework-api-reference-f762b790" })Use this skill with your agent
Create a free account and connect via MCP
# Power Apps Component Framework API Reference
The Power Apps component framework provides a rich set of APIs that enable you to create powerful code components. This reference lists all available interfaces and their availability across different app types.
## API Availability
The following table shows all API interfaces available in the Power Apps component framework, along with their availability in model-driven apps and canvas apps.
| API | Model-driven apps | Canvas apps |
|-----|------------------|-------------|
| AttributeMetadata | Yes | No |
| Client | Yes | Yes |
| Column | Yes | Yes |
| ConditionExpression | Yes | Yes |
| Context | Yes | Yes |
| DataSet | Yes | Yes |
| Device | Yes | Yes |
| Entity | Yes | Yes |
| Events | Yes | Yes |
| Factory | Yes | Yes |
| Filtering | Yes | Yes |
| Formatting | Yes | Yes |
| ImageObject | Yes | Yes |
| Linking | Yes | Yes |
| Mode | Yes | Yes |
| Navigation | Yes | Yes |
| NumberFormattingInfo | Yes | Yes |
| Paging | Yes | Yes |
| Popup | Yes | Yes |
| PopupService | Yes | Yes |
| PropertyHelper | Yes | Yes |
| Resources | Yes | Yes |
| SortStatus | Yes | Yes |
| StandardControl | Yes | Yes |
| UserSettings | Yes | Yes |
| Utility | Yes | Yes |
| WebApi | Yes | Yes |
## Key API Namespaces
### Context APIs
The `Context` object provides access to all framework capabilities and is passed to your component's lifecycle methods. It contains:
- **Client**: Information about the client (form factor, network status)
- **Device**: Device capabilities (camera, location, microphone)
- **Factory**: Factory methods for creating framework objects
- **Formatting**: Number and date formatting
- **Mode**: Component mode and tracking
- **Navigation**: Navigation methods
- **Resources**: Access to resources (images, strings)
- **UserSettings**: User settings (locale, number format, security roles)
- **Utils**: Utility methods (getEntityMetadata, hasEntityPrivilege, lookupObjects)
- **WebApi**: Dataverse Web API methods
### Data APIs
- **DataSet**: Work with tabular data
- **Column**: Access column metadata and data
- **Entity**: Access record data
- **Filtering**: Define data filtering
- **Linking**: Define relationships
- **Paging**: Handle data pagination
- **SortStatus**: Manage sorting
### UI APIs
- **Popup**: Create popup dialogs
- **PopupService**: Manage popup lifecycle
- **Mode**: Get component rendering mode
### Metadata APIs
- **AttributeMetadata**: Column metadata (model-driven only)
- **PropertyHelper**: Property metadata helpers
### Standard Control
- **StandardControl**: Base interface for all code components with lifecycle methods:
- `init()`: Initialize component
- `updateView()`: Update component UI
- `destroy()`: Cleanup resources
- `getOutputs()`: Return output values
## Usage Guidelines
### Model-Driven vs Canvas Apps
Some APIs are only available in model-driven apps due to platform differences:
- **AttributeMetadata**: Model-driven only - provides detailed column metadata
- Most other APIs are available in both platforms
### API Version Compatibility
- Always check the API availability for your target platform (model-driven or canvas)
- Some APIs may have different behaviors across platforms
- Test components in the target environment to ensure compatibility
### Common Patterns
1. **Accessing Context APIs**
```typescript
// In init or updateView
const userLocale = context.userSettings.locale;
const isOffline = context.client.isOffline();
```
2. **Working with DataSet**
```typescript
// Access dataset records
const records = context.parameters.dataset.records;
// Get sorted columns
const sortedColumns = context.parameters.dataset.sorting;
```
3. **Using WebApi**
```typescript
// Retrieve records
context.webAPI.retrieveMultipleRecords("account", "?$select=name");
// Create record
context.webAPI.createRecord("contact", data);
```
4. **Device Capabilities**
```typescript
// Capture image
context.device.captureImage();
// Get current position
context.device.getCurrentPosition();
```
5. **Formatting**
```typescript
// Format date
context.formatting.formatDateLong(date);
// Format number
context.formatting.formatDecimal(value);
```
## Best Practices
1. **Type Safety**: Use TypeScript for type checking and IntelliSense
2. **Null Checks**: Always check for null/undefined before accessing API objects
3. **Error Handling**: Wrap API calls in try-catch blocks
4. **Platform Detection**: Check `context.client.getFormFactor()` to adapt behavior
5. **API Availability**: Verify API availability for your target platform before use
6. **Performance**: Cache API results when appropriate to avoid repeated calls
## Additional Resources
- For detailed documentation on each API, refer to the [Power Apps component framework API reference](https://learn.microsoft.com/power-apps/developer/component-framework/reference/)
- Sample code for each API is available in the [PowerApps-Samples repository](https://github.com/microsoft/PowerApps-Samples/tree/master/component-framework)Related Skills
More skills in Software Engineering
Accessibility Standards
Comprehensive web accessibility standards based on WCAG 2.2 AA, with 38+ anti-patterns, legal enforcement context (EAA, ADA Title II), WAI-ARIA patterns, and framework-specific fixes for modern web frameworks and libraries.
Accord
Authoring unified specification packages across Business/Development/Design teams via staged elaboration (L0 Vision → L1 Requirements → L2 Team Detail → L3 Acceptance Criteria). No code. Use when authoring cross-team specs, building L0-L3 packages, or aligning Biz/Dev/Design on a single source of truth.
Acquire Codebase Knowledge
Use this skill when the user explicitly asks to map, document, or onboard into an existing codebase. Trigger for prompts like "map this codebase", "document this architecture", "onboard me to this repo", or "create codebase docs". Do not trigger for routine feature implementation, bug fixes, or narrow code edits unless the user asks for repository-level discovery.
Acreadiness Assess
Run the AgentRC readiness assessment on the current repository and produce a static HTML dashboard at reports/index.html. Wraps `npx github:microsoft/agentrc readiness` and hands off rendering to the @ai-readiness-reporter custom agent. Supports policies (--policy) for org-specific scoring. Use when asked to assess, audit, or score the AI readiness of a repo.
Acreadiness Generate Instructions
Generate tailored AI agent instruction files via AgentRC instructions command. Produces .github/copilot-instructions.md (default, recommended for Copilot in VS Code) plus optional per-area .instructions.md files with applyTo globs for monorepos. Use after running /acreadiness-assess to close gaps in the AI Tooling pillar.
Acreadiness Policy
Help the user pick, write, or apply an AgentRC policy. Policies customise readiness scoring by disabling irrelevant checks, overriding impact/level, setting pass-rate thresholds, or chaining org baselines with team overrides. Use when the user asks about strict mode, AI-only scoring, custom weights, CI gating, or wants org-wide standardisation.
Explore Other Categories
Skills from other categories with shared topics
Create Tldr Page
Create a tldr page from documentation URLs and command examples, requiring both URL and command name.
Demonstrate Understanding mode instructions
Validate user understanding of code, design patterns, and implementation details through guided questioning.
Makefile Development Instructions
Best practices for authoring GNU Make Makefiles