Code Scanner
This page describes the properties of the Code Scanner widget, which is used for scanning barcodes and QR codes.
The following formats for QR and barcodes are supported:
1D product | 1D industrial | 2D |
---|---|---|
UPC-A | Code 39 | QR Code |
UPC-E | Code 128 | Data Matrix |
EAN-8 | ITF | Aztec |
EAN-13 | RSS-14 | PDF 417 |
Content properties
These properties are customizable options present in the property pane of the widget, allowing users to modify the widget according to their preferences.
Basic
Scanner layout
Determines the visual appearance and behavior of the code scanner widget.
Options:
- Always On: The code scanner widget is always active and ready for scanning.
- Click to Scan: The code scanner widget acts as a button that is activated only when clicked by the user.
Text string
Specifies the label text displayed alongside the scanning widget. This property is only available when the Scanner layout is selected as Click to Scan.
General
Visible boolean
Controls the visibility of the widget. If you turn off this property, the widget is not visible in View mode. Additionally, you can use JavaScript by clicking on JS next to the Visible property to control the widget's visibility conditionally.
For example, if you want to make the widget visible only when the user checks an item in a Checkbox widget, you can use the following JavaScript expression in the visible property of the Code Scanner widget:
{{Checkbox1.isChecked}}
Disabled boolean
Prevents users from selecting the widget. Even though the widget remains visible, user input is not permitted. Additionally, you can use JavaScript by clicking on JS next to the Disabled
property to control the widget's disabled state conditionally.
For example, if you want to allow only a specific user to interact with the Code Scanner widget, you can use the following JavaScript expression:
{{appsmith.user.email=="john@appsmith.com"?false:true}}
Animate Loading boolean
Controls whether the widget is displayed with a loading animation. When enabled, the widget shows a skeletal animation during the loading process. Additionally, you can control it through JavaScript by clicking on the JS next to the property.
Tooltip string
Sets a tooltip that appears when the user hovers over the widget. It enables you to add hints or provide additional information for the button. The icon properties are only available for the Click to Scan Scanner layout option.
Events
When an event is triggered, these event handlers can execute queries, JS code, or other supported actions.
onCodeDetected
Triggered when a valid code is detected.
Style properties
Style properties allow you to change the look and feel of the button.
Icon
The icon properties are only accessible for the Click to Scan Scanner layout option.
Select icon string
Specifies the icon to be displayed on the widget. Additionally, you can use JS to dynamically set the icon. You can refer to the documentation of blueprintjs to explore a wide range of available icons.
Position string
This property allows you to configure the Icon's placement.
Options:
- Left: Aligns the icon to the left side of the Text.
- Right: Aligns the icon to the right side of the Text.
Placement string
Determines the spacing between the Icon and the Text.
Options:
- Start: The icon and text appear on the leftmost side of the button.
- Between: The icon and text appear at opposite ends of the button's space.
- Center: The icon and text appear in the center of the button space.
This property can be dynamically set using JavaScript by providing a string value of START
, CENTER
, or BETWEEN
.
Color
Button color string
Represents the color of the button, specified as a CSS color value. Additionally, the font color can be programmatically modified using JavaScript functions.