Skip to main content

Confirmation Slider

Reference for the UI Kit 4.0.0 ConfirmationSlider component: a slide-to-confirm control for critical actions in SPECS Lenses, with a confirmation threshold and reset events.

  • Snapchat: not supported
  • SPECS: fully supported
  • Camera Kit Web: not supported
  • Camera Kit Mobile: not supported
  • SnapchatNot supported
  • SPECSFully supported
  • Camera Kit WebNot supported
  • Camera Kit MobileNot supported

Platform details

  • Snapchat — Not supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Not supported.

  • Camera Kit Mobile — Not supported.

The UI Kit ConfirmationSlider component is a specialized Slider for high intent interactions. Are you confirming a payment, a message send, or a settings change? Do you want to confirm the user is sure they want to take that action? This slider is for you: the action runs only once the user slides it past its confirmation threshold.

A System 3.0 confirmation slider being dragged toward its confirmed end

Confirmation Slider Inspector properties

The ConfirmationSlider component in the Inspector, with Add Callbacks checked and Confirmation Threshold at 0.9
PropertyDescription
Render OrderSets the renderOrder for the visuals of the element.
InactiveMakes the element ignore input and shows its inactive look. Think "grayed out."
Play AudioTurns on the built-in audio cues for the element.
ThemeThe theme the slider uses: Inherited (the default, follows the global theme) or System 3.0.
SizeSets the size of the element. X is width, Y is height and Z is the depth of the underlying collider.
SegmentedSubdivides the slider into stops instead of smooth dragging, as on a Slider.
Number Of Segments(shows if Segmented is checked) The number of stops from start to finish inclusive. The default is 5.
Knob IconAn optional icon drawn on the knob, which moves with it.
Add CallbacksAdds the editor hooks for the event callbacks to the element.
On Value Changed Callbacks(shows if Add Callbacks is checked) A callback for when the element's value changes.
On Confirmation Callbacks(shows if Add Callbacks is checked) A callback for when the user confirms by sliding past the threshold.
On Reset Callbacks(shows if Add Callbacks is checked) A callback for when the slider resets to its initial state.
Confirmation ThresholdHow far, from 0 to 1, the user must slide to confirm. The default is 0.9.

Create a Confirmation Slider from a script

The script below creates a confirmation slider and prints a message when it is confirmed. To make the slider usable again after a confirmation, call reset(), which also fires onReset.

import { ConfirmationSlider } from 'UIKit.lspkg/Scripts/Components/Slider/ConfirmationSlider';

/**
* Example script for the ConfirmationSlider component.
* It creates a confirmation slider and prints a message when it is confirmed.
*/

@component
export class ExampleConfirmationSliderScript extends BaseScriptComponent {
onAwake() {
const slider = this.sceneObject.createComponent(
ConfirmationSlider.getTypeName()
) as ConfirmationSlider;
slider.size = new vec3(20, 4, 1);
slider.initialize();
slider.onConfirmation.add(() => {
print(`Confirmation slider confirmed`);
});
}
}
  • Slider: the base slider and its value events.
  • Button: a single press for actions that don't need confirmation.