Skip to content

Checkbox

Overview

Checkbox is a typical checkbox UI component.

@author Chris Malley (PixelZoom, Inc.)

Class Checkbox

import { Checkbox } from 'scenerystack/sun';

Constructor

new Checkbox( property : PhetioProperty<boolean>, content : Node, providedOptions? : CheckboxOptions )

Instance Methods

setInputEnabledProperty( newTarget : TReadOnlyProperty<boolean> | null ) : this

The inputEnabledProperty for Checkbox is internally controlled by factors such as the displayOnlyProperty and the enabledProperty.

dispose()

setCheckboxColorBackground( value : TPaint )

Sets the background color of the checkbox.

getCheckboxColorBackground() : TPaint

Gets the background color of the checkbox.

setCheckboxColor( value : TPaint )

Sets the color of the checkbox.

getCheckboxColor() : TPaint

Gets the color of the checkbox.

setMouseArea( area : Shape | Bounds2 | null ) : this

setTouchArea( area : Shape | Bounds2 | null ) : this

Type CheckboxOptions

import type { CheckboxOptions } from 'scenerystack/sun';
  • spacing?: number
  • boxWidth?: number
  • checkboxColor?: TPaint
  • checkboxColorBackground?: TPaint
  • touchAreaXDilation?: number
    pointer areas
  • touchAreaYDilation?: number
  • mouseAreaXDilation?: number
  • mouseAreaYDilation?: number
  • checkedSoundPlayer?: TSoundPlayer
    sounds
  • uncheckedSoundPlayer?: TSoundPlayer
  • checkedContextResponse?: TAlertable
    Utterances to be spoken with a screen reader after the checkbox is pressed. Also used for the voicingContextResponse.
  • uncheckedContextResponse?: TAlertable
  • voiceNameResponseOnSelection?: boolean
    By default voice the name response on checkbox change (with the context response), but optionally turn it off here.
  • voicingCheckedObjectResponse?: TAlertable
    Output describing the state of the Checkbox after it is pressed using the Voicing feature. Like "Checked" or "Locked". Not usually needed, default is null.
  • voicingUncheckedObjectResponse?: TAlertable
  • phetioDisplayOnlyPropertyInstrumented?: boolean
    whether the displayOnlyProperty for this checkbox is instrumented for PhET-iO
  • & StrictOmit<ParentOptions, "children" | "mouseArea" | "touchArea" | "tagName">

Source Code

See the source for Checkbox.ts in the sun repository.