A Power Apps Component Framework (PCF) control for capturing keyboard-wedge barcode scanner input in Canvas Apps.
- ✅ Captures barcode scanner input (keyboard-wedge scanners)
- ✅ Commits scan on Enter key
- ✅ Auto-focus to keep input ready
- ✅ Configurable max length
- ✅ Clear signal to reset buffer
- ✅ Scan counter for tracking
| Property | Type | Default | Description |
|---|---|---|---|
Enabled |
Boolean | true |
Enable/disable scanner input |
AutoFocus |
Boolean | true |
Auto-focus hidden input to capture scans |
MaxLength |
Number | 256 |
Maximum barcode length |
ClearSignal |
Number | 0 |
Increment to clear the output |
| Property | Type | Description |
|---|---|---|
sampleoutput |
Text | The last scanned barcode value |
scancount |
Number | Total number of scans captured |
- Node.js (v18+)
- Power Platform CLI
- .NET SDK
# Clone the repo
git clone https://github.com/RogerHarr1/ScanListener.git
cd ScanListener
# Install dependencies
npm install
# Build the control
npm run build
# Build the solution package
cd Solutions
dotnet build /p:configuration=ReleaseThe solution package will be at: Solutions/bin/Release/Solutions.zip
- Go to make.powerapps.com → Solutions
- Click Import solution
- Browse to
Solutions/bin/Release/Solutions.zip - Click Next → Import
- Open your Canvas app in Power Apps Studio
- Go to Settings → Upcoming features → Experimental
- Turn ON "Allow code component framework apps"
- Click Insert → Get more components
- Switch to the Code tab
- Find ScanListener and click Import
- Drag the control onto your screen
// Display the scanned barcode
Label.Text: ScanListener1.sampleoutput
// Show scan count
Label.Text: "Scans: " & ScanListener1.scancount
// Clear on button press (increment ClearSignal)
Button.OnSelect: UpdateContext({varClear: varClear + 1})
ScanListener1.ClearSignal: varClear
// OnChange of ScanListener1
If(
!IsBlank(Self.sampleoutput),
Collect(
ScannedItems,
{
Barcode: Self.sampleoutput,
ScannedAt: Now()
}
)
)
| Technology | Purpose |
|---|---|
| TypeScript | Control logic |
| PCF | Power Apps component framework |
| HTML DOM | Hidden input for keyboard capture |
| Webpack | Bundling |
| .NET SDK | Solution packaging |
ScanListener/
├── ControlManifest.Input.xml # Control manifest
├── index.ts # Main control logic
├── package.json # Dependencies
├── tsconfig.json # TypeScript config
├── pcfconfig.json # PCF config
└── Solutions/ # Solution packaging
└── Solutions.cdsproj
- Ensure
Enabledistrue - Ensure
AutoFocusistrue - Click on the control area to focus it
- Increase
MaxLengthproperty
- Increment
ClearSignalto reset the buffer
MIT