Code Scanner (ALPHA)
Responsive Widgets are in alpha and available by invitation only on Business and Enterprise plans. Behavior and properties may change. To request access, open a support ticket and name the feature Responsive Widgets (ALPHA).
The Code Scanner widget reads QR codes and barcodes with the device camera. It stores the decoded text so you can use it in queries and other widgets. The camera turns on only in the deployed app.
Treat the scanned text as untrusted input. Do not navigate to it or show it as HTML without checking it first.
Widget type: WDS_CODE_SCANNER_WIDGET

Content properties
These properties appear in the Content tab of the property pane.
Basic
Scanner layout string
Sets how the scanner works. You cannot bind this property. Options:
- Always on (default): the scanner stays visible and keeps scanning.
- Click to scan: shows a button that opens the scanner in a dialog.
Values: ALWAYS_ON, CLICK_TO_SCAN.
Text string
Sets the label of the scan button. Default: Scan a QR/Barcode. Shows only when Scanner layout is Click to scan.
General
Default mobile camera string
Sets which camera to use first on mobile devices. If that camera is not available, the browser uses any camera it can find. Options:
- Front (Selfie):
user - Back (Rear) (default):
environment
Visible boolean
Controls whether the widget is visible. Default: on.
Disabled boolean
Turns off the widget. The camera does not run while it is disabled. Default: off.
Animate loading boolean
Controls the loading animation of the widget. Default: on.
Events
onCodeDetected
Sets the action that runs when the scanner finds a code. See Events.
Style properties
These properties appear in the Style tab of the property pane.
Custom styling
These settings are in the Custom styling section, at the end of the Style tab. An empty setting uses the theme value. For theme colors, dark mode, and the rules for custom CSS, see Custom styling.
Background string
Sets the background of the outer card. It does not change the camera view. Takes a theme color or a custom color.
Border color string
Sets the border color of the outer card. Takes a theme color or a custom color. A color with no Border width draws a thin border.
Border width string
Sets the border width of the outer card. Options: From theme (default), None, Thin, Medium, Thick. You cannot bind this property.
Corners string
Sets the corner radius of the outer card. Options: From theme (default), Sharp, Rounded, Pill. You cannot bind this property.
Custom CSS string
Adds plain CSS to this widget. Rules apply only inside the widget, and & is the outer card. You cannot bind this property.
Reference properties
Reference properties let you read the widget's state in bindings and code, for example {{CodeScanner1.isVisible}}. You cannot set them directly.
value string
Holds the decoded text of the last code. It is empty until the scanner finds a code.
Example:
{{CodeScanner1.value}}
scannedText string
Holds the same text as value. It is an empty string until the scanner finds a code.
Example:
{{CodeScanner1.scannedText}}
isVisible boolean
Shows whether the widget is visible.
Example:
{{CodeScanner1.isVisible}}
isDisabled boolean
Shows whether the widget is disabled.
Example:
{{CodeScanner1.isDisabled}}
Methods
Methods let you change the widget's properties from code, for example in a JS Object.
setVisibility (param: boolean): Promise
Shows or hides the widget.
Example:
CodeScanner1.setVisibility(false)
setDisabled (param: boolean): Promise
Turns the widget on or off.
Example:
CodeScanner1.setDisabled(true)
Events
onCodeDetected
Runs when the scanner finds a code. Read the text in {{CodeScanner1.value}}.