The world's most comprehensive collection of Power Fx code snippets for Microsoft Power Platform
Major repository restructuring complete! The repository has been reorganized with a feature-first architecture for better navigation, discoverability, and developer experience.
π£ Read the full v2.0.0 Announcement | π Release Notes
| Category | Description | Highlights |
|---|---|---|
| π± app-lifecycle/ | App initialization & lifecycle | Named formulas, OnStart, OnError |
| π¨ ui-controls/ | Control-specific snippets | Gallery, buttons, inputs, charts |
| π ui-patterns/ | Reusable UI patterns | Dialogs, menus, theming, components |
| π visual-assets/ | Visual resources | SVGs, icons, colors, fonts, emojis |
| π data-operations/ | Data & transformations | Sample data, JSON, geocoding |
| π§ functions/ | Functions & utilities | UDFs, algorithms, string manipulation |
| π integrations/ | External services | Office 365, Power Automate connectors |
| π learning/ | Educational content | Tutorials, certification, best practices |
| π§° utilities/ | Tools & templates | Validation scripts, templates |
- 468 markdown files with standardized structure
- YAML frontmatter on all snippets for searchability
- Table of Contents auto-generated in all files
- History sections tracking changes in every file
- GitHub Actions for automated snippet validation and weekly link checking
- Unit test coverage for all repository tools (validator, index generator, migration helper)
- Issue & PR templates for consistent contributions
- PRODUCT-INDEX.md -- Browse snippets by Power Platform product
- MIGRATION-GUIDE.md -- Find where your old bookmarks moved
π View Migration Details | π Browse by Product
New to Power Fx? Start here:
- π Getting Started Guide
- π‘ Hello World Examples
β οΈ Power Fx Gotchas -- Syntax quirks that differ from .NET/Excel/JavaScript
1. Detect if the app is running in Studio (edit) mode:
// Named formula -- place in App.Formulas
fxIsInStudioMode = StartsWith(Host.Version, "PowerApps-Studio");
Source: app-lifecycle/formulas/expressions/boolean-is-in-studio-mode.md
2. Alternating row colors (zebra striping) in a Gallery:
// Set TemplateFill on your Gallery control
If(
Mod(ThisItem.OrderNumber, 2) = 0,
Color.White,
ColorFade(App.Theme.Colors.Lighter80, 50%)
)
Source: ui-controls/gallery/styling/alternating-row-colors.md
3. Convert a Color value to its hex string:
// User-defined function -- place in App.Formulas
fxGetHexFromColor(ColorValue: Color): Text = Left(
Substitute(
JSON(ColorValue, JSONFormat.Compact),
"""",
""
),
7
);
Source: ui-patterns/theming/Theming.md
4. Random screen transition effect (UDF):
// User-defined function -- place in App.Formulas
fxRandomScreenTransition(): Text =
With(
{ RandomNumber: RandBetween(1, 5) },
Switch(
RandomNumber,
1, ScreenTransition.Cover,
2, ScreenTransition.CoverRight,
3, ScreenTransition.Fade,
4, ScreenTransition.UnCover,
5, ScreenTransition.UnCoverRight,
ScreenTransition.None
)
);
Source: app-lifecycle/formulas/user-defined-functions/screen-transition-random.md
5. Parse JSON returned from a Power Automate flow:
UpdateContext(
{
locFlowResult: ParseJSON(MyFlow.Run(ThisItem.URL).response).value
}
);
ClearCollect(
colParsedData,
ForAll(
locFlowResult As MyRecord,
{
Name: Text(MyRecord.Name),
DisplayName: Text(MyRecord.DisplayName),
Type: Text(MyRecord.Type)
}
)
);
| Category | Description | Quick Access |
|---|---|---|
| 01-getting-started | Entry point for new developers | Hello World β’ Common Patterns (Coming Soon) |
| 02-app-architecture | Application structure and lifecycle | App Events β’ Navigation |
| 03-user-interface | UI components and user experience | Controls β’ Themes |
| 04-data-management | Data operations and sources | Data Sources β’ Validation |
| 05-business-logic | Functions and calculations | Functions β’ Error Handling |
| 06-integrations | External services and APIs | Microsoft 365 β’ Azure |
| 07-assets-and-media | Visual assets and media | Icons β’ SVGs |
| 08-advanced-patterns | Expert techniques and architecture | Custom Components β’ Security |
| 09-learning-resources | Tutorials and educational content | Tutorials β’ Best Practices |
- π Contribution Guide - How to add your own snippets
- π§ Tools & Utilities - Helper scripts and utilities
- π Documentation - Detailed guides and references
β οΈ Power Fx Gotchas - Syntax quirks that differ from .NET/Excel/JavaScript- ποΈ Code of Conduct - Community standards
| Snippet | Category | Difficulty |
|---|---|---|
| Alternating Row Colors | ui-controls / gallery | Intermediate |
| Detect Studio Mode | app-lifecycle / formulas | Beginner |
| Color to Hex Conversion | ui-patterns / theming | Intermediate |
| Random Screen Transition | app-lifecycle / formulas | Beginner |
| Error Kinds Collection | app-lifecycle / formulas | Beginner |
| Snippet | Category | Difficulty |
|---|---|---|
| Responsive Hero Cards Gallery | ui-controls / gallery | Intermediate |
| Get Manager Rollup (Org Hierarchy) | integrations / Office 365 | Advanced |
| Parse JSON from Power Automate Flows | data-operations / json | Intermediate |
| Proportional Value Calculator (UDF) | app-lifecycle / formulas | Intermediate |
| Microsoft Base Themes | ui-patterns / theming | Beginner |
Browse all snippets: By Category | By Product | By Tag
- Start with Getting Started category
- Browse by difficulty level (beginner/intermediate/advanced)
- Use the search function with keywords like "gallery", "form", or "SharePoint"
- Jump directly to specific categories that match your needs
- Filter by tags and prerequisites
- Check related snippets for comprehensive solutions
- Use Learning Resources for onboarding
- Implement Best Practices across projects
- Leverage Advanced Patterns for complex scenarios
- Power Apps: Canvas Apps, Data Sources
- Power Automate: Flows, API Calls
- Dataverse: Data Operations, Security
- SharePoint: Integration, Document Management
- Business Apps: Forms, Workflows
- Dashboards: Charts, KPIs
- Mobile Apps: Responsive Design (Coming Soon), Offline
- Admin Tools: User Management, Audit Logs
We welcome contributions! Here's how to get involved:
- π Add Snippets: Share your Power Fx solutions
- π Report Issues: Help improve existing content
- π‘ Suggest Improvements: Propose new categories or features
- π Improve Documentation: Enhance guides and navigation
- Read our Contribution Guide
- Check existing Issues for ideas
- Fork the repository and create your branch
- Add your snippet with proper metadata
- Submit a pull request
- β Metadata: Complete YAML front matter with title, description, category, tags, difficulty
- β Documentation: Clear explanation and usage examples
- β Code Quality: Well-formatted, commented Power Fx code
- β Testing: Include test scenarios where applicable
- π Categories: 9 main categories with 40+ subcategories
- π Snippets: 500+ code examples and patterns
- π·οΈ Tags: 200+ searchable tags for filtering
- π₯ Contributors: 50+ community members
- β Stars: Your support helps grow the community!
Power Fx is the low-code language that powers Microsoft Power Platform applications. It combines the familiarity of Excel formulas with the power of a programming language, enabling both citizen developers and professional developers to create sophisticated business applications.
Key Features:
- π Excel-like syntax you already know
- π§ IntelliSense and formula suggestions
- π Cross-platform compatibility
- β‘ Real-time evaluation and debugging
- π Rich integrations with Microsoft 365 and Azure
- π Issues: Report bugs or request features
- π¬ Discussions: Join community conversations
- π Power Platform Community: powerplatform.com
- π Microsoft Learn: Power Fx documentation
- π Training: Power Apps training
Where did my old bookmark go? The repository was restructured in v2.0.0 (January 2026). All files were reorganized into 9 feature-based categories. See the Migration Guide for a complete mapping of old paths to new locations.
How do I find snippets by product (Canvas Apps, Model-Driven, Power Automate)? Check the Product Index which groups every snippet by the Power Platform product it applies to.
How do I contribute a snippet? Read the Contributing Guide for instructions on adding snippets, reporting issues, or proposing improvements. Every snippet needs YAML frontmatter, a clear description, and working Power Fx code.
Power Fx is not working the way I expected.
Power Fx has important syntax differences from .NET, Excel, and JavaScript. Before debugging further, read the Power Fx Gotchas document -- especially the section on date/time formatting where m/mm is context-sensitive.
How do I validate my snippet before submitting?
Run the snippet validator tool: python utilities/tools/snippet-validator.py your-file.md. This checks YAML frontmatter, required fields, and valid category/tag values.
This repository is licensed under the MIT License - see the LICENSE file for details.
- Power Apps Community for inspiration and contributions
- Microsoft Power Platform team for creating Power Fx
- All Contributors who share their knowledge and expertise
- You for being part of this amazing community!
β Found this helpful? Star this repository to show your support!
π€ Want to contribute? Check out our Contribution Guide to get started!
| Date | Author | Changes |
|---|---|---|
| 2026-01-29 | Phase 6 | v2.0.0 launch updates: enhanced Quick Start, Popular Snippets, FAQ, What's New |
| 2026-01-27 | Migration | Initial TOC and history section added |