Class Checkbox

A checkbox widget with standard styling.

Index

Methods

build

  • build(): HTMLElement

getElement

  • getElement(): HTMLElement

getLabel

  • getLabel(): HTMLElement
  • Gets the element on which the checkbox [label]{@link Checkbox.label} is bound.

    Returns HTMLElement

    The label element.

getValue

  • getValue(): string

isSelected

  • isSelected(): boolean
  • Indicates whether the checkbox is checked.

    Returns boolean

    true if the checkbox is checked, false otherwise.

reset

  • reset(): void

select

  • select(triggerChange?: boolean): void
  • Select the checkbox

    Parameters

    • Default value triggerChange: boolean = true

      will trigger change even if specified and not already selected

    Returns void

toggle

  • toggle(): void

Constructors

constructor

  • new Checkbox(onChange?: function, label: string, ariaLabel?: string, labelSuffix?: string): Checkbox
  • Creates a new Checkbox.

    Parameters

    • Default value onChange: function = (checkbox: Checkbox) => {}

      The function to call when the checkbox state changes. This function takes the current Checkbox instance as an argument.

    • label: string

      The label to display next to the checkbox.

    • Optional ariaLabel: string
    • Optional labelSuffix: string

    Returns Checkbox

Hierarchy

  • Checkbox

Implements

  • IFormWidgetWithLabel
  • IFormWidgetSelectable