Scanner

A scanner to capture barcodes using a connected camera or webcam. It supports scan event handlers, skipping duplicates, single or continuous scanning, and programmatic control of pausing/resuming.

Properties

Available properties for Scanner with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read information about components.

NameTypeDescriptioncameraIdstring

The internal ID of the camera used for scanning.

dataunknown[]

A list of values scanned by the barcode.

hiddenboolean

Whether the component is visible.

ignoreDuplicatesboolean

Whether to ignore duplicate values when capturing multiple barcodes.

maintainSpaceWhenHiddenboolean

Whether the component takes up space on the canvas if hidden is true.

marginstring

The amount of margin to render outside of the component.

pausedboolean

Whether the scanner is currently paused.

showInEditorboolean

Whether the component remains visible in the editor if hidden is true.

singleScanboolean

Whether to pause the scanner after each scan.

timeBetweenScansnumber

The time in milliseconds between scans.

Events

Events are triggered by user interactions with Scanner. Use event handling to trigger queries or other actions in response to events.

NameDescriptionScan

A user scans a barcode.

Methods

Methods for interacting with Scanner. You can write JavaScript almost anywhere in Retool and use methods to manipulate data or components.

NameDescriptionscrollIntoView(options: any)

Scrolls the canvas or parent container so that the selected component appears in the visible area.

setHidden(hidden: boolean)

Set the hidden value to toggle whether the component is visible. Defaults to true without a parameter.

clearValue()

Clear the current value of data.

resume()

Resume scanning.

pause()

Pause scanning.

setSingleScan()

Set singleScan to the provided boolean value.

setIgnoreDuplicates()

Set ignoreDuplicates to the provided boolean value.

setTimeBetweenScans()

Set timeBetweenScans to the provided number value.