Class “CheckBox”

Object > NativeObject > Widget > CheckBox

A check box widget.

CheckBox on Android
Android
CheckBox on iOS
iOS
Type: CheckBox extends Widget
Constructor: public
Singleton: No
Namespace: tabris
Direct subclasses: None
JSX Support: Element: <CheckBox/>
Parent Elements: <Canvas/>, <Composite/>, <Page/>, <RefreshComposite/>, <ScrollView/>, <Stack/>, <Tab/>
Child Elements: Not Supported
Text Content: text

Examples

JavaScript

import {CheckBox, contentView} from 'tabris';

new CheckBox({text: 'Checkbox'})
  .onSelect(event => console.log(`Checkbox checked: ${event.checked}`))
  .appendTo(contentView);

See also:

JSX Creating a simple Checkbox

Constructor

new CheckBox(properties?)

Parameter Type Description
properties Properties<CheckBox> Sets all key-value pairs in the properties object as widget properties. Optional.

Properties

checked

The checked state of the check box.

Type: boolean
Default: false
Settable: Yes
Change Event: checkedChanged

checkedTintColor

The color of the selectable area in checked state. Will fall back to tintColor if not set.

Type: ColorValue
Settable: Yes
Change Event: checkedTintColorChanged

font

The font used for the text.

Type: FontValue
Settable: Yes
Change Event: fontChanged

text

The label text of the check box.

Type: string
Settable: Yes
Change Event: textChanged
JSX Text Property: Yes

When using CheckBox as an JSX element the elements Text content is mapped to this property.

textColor

The color of the text.

Type: ColorValue
Settable: Yes
Change Event: textColorChanged

tintColor

The color of the selectable area.

Type: ColorValue
Settable: Yes
Change Event: tintColorChanged

Events

select

Fired when the check box is checked or unchecked by the user.

EventObject Type: CheckBoxSelectEvent<CheckBox>

Property Type Description
checked boolean The new value of checked.

Change Events

checkedChanged

Fired when the checked property has changed.

EventObject Type: PropertyChangedEvent<CheckBox, boolean>

Property Type Description
value boolean The new value of checked.

textChanged

Fired when the text property has changed.

EventObject Type: PropertyChangedEvent<CheckBox, string>

Property Type Description
value string The new value of text.

textColorChanged

Fired when the textColor property has changed.

EventObject Type: PropertyChangedEvent<CheckBox, ColorValue>

Property Type Description
value ColorValue The new value of textColor.

tintColorChanged

Fired when the tintColor property has changed.

EventObject Type: PropertyChangedEvent<CheckBox, ColorValue>

Property Type Description
value ColorValue The new value of tintColor.

checkedTintColorChanged

Fired when the checkedTintColor property has changed.

EventObject Type: PropertyChangedEvent<CheckBox, ColorValue>

Property Type Description
value ColorValue The new value of checkedTintColor.

fontChanged

Fired when the font property has changed.

EventObject Type: PropertyChangedEvent<CheckBox, FontValue>

Property Type Description
value FontValue The new value of font.