/PCF-Universal-Textbox-Fluent

The PCF component built with Fluent UI React v9 to display various types of text data, including markdown, Json and html.

Primary LanguageTypeScriptMIT LicenseMIT

PCF Universal Textbox Fluent

A comprehensive PowerApps Component Framework (PCF) control that provides a universal textbox component using Fluent UI React v9. The component supports multiple text formats including Markdown, JSON, HTML, Rich Text, and Plain Text with advanced rendering capabilities.

✨ Features

  • 🎯 Multiple Text Formats: Supports Markdown, JSON, HTML, Rich Text, and Plain Text
  • 🎨 Modern UI: Built with Fluent UI React v9 for consistent Microsoft design language
  • 📊 Mermaid Diagrams: Renders flowcharts, sequence diagrams, and more within Markdown
  • 🧮 Mathematical Expressions: KaTeX support for complex mathematical notation
  • 🎨 Syntax Highlighting: Code blocks with language-specific highlighting
  • 🖼️ Image Modal: Click-to-zoom functionality with keyboard controls
  • 🐛 Debug Mode: View rendered HTML source for troubleshooting
  • 📱 Responsive Design: Adapts to container size and device capabilities
  • ♿ Accessibility: ARIA labels and keyboard navigation support

📸 Screenshots

View Type Screenshot
Markdown View Markdown View
JSON View JSON View
Debug View Debug View
Model-Driven App MDA Integration

🚀 Quick Start

Option 1: Use Pre-built Solution

  1. Download the latest release from GitHub Releases
  2. Import the solution to your Power Platform environment
  3. Add the control to your forms or canvas apps

Option 2: Build from Source

# Clone the repository
git clone https://github.com/illusion615/PCF-Universal-Textbox-Fluent.git
cd PCF-Universal-Textbox-Fluent

# Install dependencies
npm install

# Build and package
npm run build
npm run rebuild

📁 Project Structure

PCF-Universal-Textbox-Fluent/
├── 📁 docs/                            # 📚 Comprehensive documentation
│   ├── ARCHITECTURE.md                 # System architecture and design
│   ├── DEVELOPMENT.md                  # Development guide and best practices
│   ├── DEPLOYMENT.md                   # Deployment instructions and troubleshooting
│   ├── API.md                         # Complete API reference
│   └── TODO.md                        # Roadmap and known issues
├── 📁 UniversalTextbox/                # 🎯 Main control implementation
│   ├── index.ts                       # PCF control class
│   ├── UniversalTextboxComponent.tsx  # React component
│   ├── UniversalTextboxComponent.css  # Component styles
│   └── ControlManifest.Input.xml      # PCF manifest
├── 📁 UniversalTextboxFluentSolution/ # 📦 Solution packaging
├── 📁 screenshots/                    # 📸 Documentation images
├── 📁 types/                          # 📝 TypeScript definitions
└── 📄 Configuration files             # Build and development setup

🔧 Configuration

Control Properties

Property Type Description Default
Text Text Main text content (bound field) Required
Text Type Enum Format: Markdown(1), JSON(2), HTML(3) Markdown
Display Mode Enum View(1), Edit(2), View and Edit(3) View
Debug Mode Boolean Enable debug view false
Font Size Text Custom font size Optional
Background Color Text Custom background color Optional
Line Height Text Custom line height Optional

Advanced Features

Markdown Enhancements

  • Mermaid Diagrams: Use mermaid code blocks for flowcharts, sequence diagrams, gantt charts
  • Mathematical Expressions: LaTeX syntax with $...$ for inline and $$...$$ for block math
  • Syntax Highlighting: 190+ programming languages supported
  • Tables: GitHub Flavored Markdown table support
  • HTML Integration: Embed HTML within markdown content

JSON Viewer

  • Collapsible Tree: Navigate large JSON structures easily
  • Type Highlighting: Visual distinction for strings, numbers, booleans, null
  • Error Handling: Graceful handling of invalid JSON with error display

Interactive Features

  • Image Zoom: Click any image to open in modal with zoom controls
  • Copy Function: One-click content copying to clipboard
  • Edit Mode: Live editing with auto-resize textarea
  • Debug View: Inspect rendered HTML for troubleshooting

📚 Documentation

Document Description
Architecture Guide System design, component architecture, and data flow
Development Guide Setup, coding guidelines, and contribution instructions
Deployment Guide Installation, configuration, and troubleshooting
API Reference Complete API documentation and examples
Roadmap & Issues Known issues, feature roadmap, and technical debt

🛠️ Development

Prerequisites

  • Node.js 14.x or higher
  • PowerApps CLI (latest version)
  • Visual Studio Code (recommended)

Development Workflow

# Start development server
npm run start

# Watch mode for continuous development
npm run start:watch

# Lint and fix code
npm run lint:fix

# Clean build artifacts
npm run clean

Building for Production

# Create optimized production build
npm run build

# Package solution for deployment
npm run rebuild

🚀 Deployment

System Requirements

  • Power Platform environment with PCF support
  • System Administrator or System Customizer role
  • Attachment size limit: Minimum 100MB (see deployment guide)

Quick Deployment Steps

  1. Download latest solution from releases
  2. Import solution to Power Platform environment
  3. Configure control properties on forms/apps
  4. Test functionality in target environment

⚠️ Important: Large bundle size may require increasing attachment limits. See Deployment Guide for details.

🔧 Technical Details

Technology Stack

  • Framework: PowerApps Component Framework (PCF)
  • Frontend: React 16.14.0 + TypeScript 4.9.5
  • UI Library: Fluent UI React v9.46.2
  • Build Tool: Webpack with optimization
  • Text Processing: markdown-it, Mermaid, KaTeX, highlight.js

Browser Support

  • Chrome 80+
  • Firefox 74+
  • Safari 13+
  • Edge 80+

Bundle Optimization

  • Code splitting: Separate chunks for better loading
  • Minification: Terser for JavaScript, CSS minimizer
  • Tree shaking: Removes unused code
  • Performance: Lazy loading for heavy features

🤝 Contributing

We welcome contributions! Please see our Development Guide for details.

Quick Contribution Steps

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Update documentation
  5. Submit a pull request

Code Standards

  • TypeScript with strict mode
  • ESLint configuration
  • React functional components with hooks
  • Comprehensive documentation

📋 Roadmap

Current Version: 1.2.2

  • ✅ Mermaid diagram support
  • ✅ Mathematical expressions (KaTeX)
  • ✅ Syntax highlighting
  • ✅ Image modal with zoom
  • ✅ JSON tree viewer

Next Release: 1.3.0

  • 🔄 Layout and sizing improvements
  • 🔄 Rich text editor integration
  • 🔄 Performance optimizations
  • 🔄 Enhanced accessibility

See TODO.md for complete roadmap and known issues.

🐛 Support & Issues

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


⭐ Star this repo if you find it useful! ⭐

📥 Download Latest Release📖 Read the Docs🐛 Report Bug💡 Request Feature