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
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.

Confirmation Slider Inspector properties

| Property | Description |
|---|---|
| Render Order | Sets the renderOrder for the visuals of the element. |
| Inactive | Makes the element ignore input and shows its inactive look. Think "grayed out." |
| Play Audio | Turns on the built-in audio cues for the element. |
| Theme | The theme the slider uses: Inherited (the default, follows the global theme) or System 3.0. |
| Size | Sets the size of the element. X is width, Y is height and Z is the depth of the underlying collider. |
| Segmented | Subdivides 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 Icon | An optional icon drawn on the knob, which moves with it. |
| Add Callbacks | Adds 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 Threshold | How 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.
- TypeScript
- JavaScript
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`);
});
}
}
// Import required modules
const ConfirmationSlider =
require('UIKit.lspkg/Scripts/Components/Slider/ConfirmationSlider').ConfirmationSlider;
/**
* Example script for the ConfirmationSlider component.
* It creates a confirmation slider and prints a message when it is confirmed.
*/
function onAwake() {
const slider = script.sceneObject.createComponent(
ConfirmationSlider.getTypeName()
);
slider.size = new vec3(20, 4, 1);
slider.initialize();
slider.onConfirmation.add(() => {
print(`Confirmation slider confirmed`);
});
}
// Start the script
onAwake();