mixin

SpecChoice

@Js
const mixin SpecChoice

Choice APIs for a specific choice spec via Namespace.choice.

methods selections

Return all choice selections the given instance implements

selection

Return single choice selection considering validation rules

isMaybe

Return if the choice slot allows zero selections

type

Choice type for the spec

isMultiChoice

Return if the choice slot allows multiple selections

spec

Spec for this choice - might be slot or choice type

subtypes

List the choice direct subtypes of given base (defaults to root choice)

isMaybe abstract Bool isMaybe()

Return if the choice slot allows zero selections

isMultiChoice abstract Bool isMultiChoice()

Return if the choice slot allows multiple selections

selection abstract Spec? selection(Dict instance, Bool checked)

Return single choice selection considering validation rules. This method is a semantically equivalent to:

selections(instance, checked).first

selections abstract Spec[] selections(Dict instance, Bool checked)

Return all choice selections the given instance implements.

  • one selection => return list of one
  • zero selections + isMaybe is true => return empty list
  • zero selections + isMaybe is false + checked is false => return empty list
  • zero selections + isMaybe is false + checked is true => raise exception
  • multiple selections + isMultiChoice is false + checked is false => return all
  • multiple selections + isMultiChoice is false + checked is true => raise exception
  • multiple selections + isMultiChoice is true + checked is true => return all

spec abstract Spec spec()

Spec for this choice - might be slot or choice type

subtypes abstract Spec[] subtypes(Spec base)

List the choice direct subtypes of given base (defaults to root choice). This method can be used to efficiently build choice taxonomy tree.

type abstract Spec type()

Choice type for the spec

Haxall 4.0.5 ∙ 24-Feb-2026 14:33 EST