API Referencegraphite
Checkbox
Toggleable checkbox with a label and change callback support.
Module: graphite
Toggleable checkbox with a label and change callback support.
Declaration
export class Checkbox extends UIObject { ... }Extends: UIObject
Constructors
constructor();constructor(font: Font, label: string, position: Position2d);Properties
label
label: string;font
font: Font;position
position: Position3d;fontSize
fontSize: number;padding
padding: Size2d;boxSize
boxSize: number;spacing
spacing: number;checked
checked: boolean;enabled
enabled: boolean;textColor
textColor: Color;boxBackgroundColor
boxBackgroundColor: Color;hoverBoxBackgroundColor
hoverBoxBackgroundColor: Color;borderColor
borderColor: Color;activeBorderColor
activeBorderColor: Color;checkColor
checkColor: Color;Methods
getSize
Returns the current dimensions.
override getSize(): Size2d;getScreenPosition
Returns the UI element's screen-space position.
override getScreenPosition(): Position2d;setScreenPosition
Sets the UI element's screen-space position.
override setScreenPosition(position: Position2d): void;getLabel
getLabel(): string;isChecked
isChecked(): boolean;isHovered
isHovered(): boolean;isEnabled
isEnabled(): boolean;style
Returns the element's style.
style(): UIStyle;setLabel
setLabel(label: string): Checkbox;setPadding
setPadding(padding: Size2d): Checkbox;setFontSize
setFontSize(size: number): Checkbox;setBoxSize
setBoxSize(size: number): Checkbox;setSpacing
setSpacing(spacing: number): Checkbox;setStyle
Applies a style to the element.
setStyle(style: UIStyle): Checkbox;setOnToggle
Registers the toggle callback and returns this checkbox for chaining.
setOnToggle(callback: Checkbox.ToggleCallback): Checkbox;setChecked
setChecked(checked: boolean): void;setEnabled
setEnabled(enabled: boolean): void;toggle
toggle(): void;