/// <summary>
        /// Called when [checkbox change].
        /// </summary>
        /// <param name="checkbox">The checkbox.</param>
        /// <returns></returns>
        internal void OnCheckboxChange(Checkbox checkbox)
        {
            var index = _checkboxItems.IndexOf(checkbox);
            int indexOffset;
            OneOf <CheckboxOption[], string[]> workWith;

            if (checkbox.IsFromOptions)
            {
                indexOffset = _indexSetOptionsOffset;
                workWith    = Options;
            }
            else
            {
                indexOffset = _indexConstructedOptionsOffset;
                workWith    = _constructedOptions;
            }


            workWith.Switch(opts =>
            {
                if (opts[index] != null)
                {
                    opts[index].Checked = checkbox.Checked;
                }
            }, opts =>
            {
                if (checkbox.Checked && !opts[index - indexOffset].IsIn(_selectedValues))
                {
                    _selectedValues = _selectedValues.Append(opts[index - indexOffset]);
                }
                else
                {
                    _selectedValues = _selectedValues.Except(new[] { opts[index - indexOffset] }).ToArray();
                }
            });

            CurrentValue = _currentValue();
            if (OnChange.HasDelegate)
            {
                OnChange.InvokeAsync(CurrentValue);
            }

            StateHasChanged();
        }
        internal void AddItem(Checkbox checkbox)
        {
            this._checkboxItems ??= new List <Checkbox>();
            this._checkboxItems?.Add(checkbox);

            checkbox.IsFromOptions = IsCheckboxFromOptions(checkbox);
            if (!checkbox.IsFromOptions)
            {
                checkbox.SetValue(_selectedValues.Contains(checkbox.Label));
                if (_indexConstructedOptionsOffset == -1)
                {
                    _indexConstructedOptionsOffset = _checkboxItems.Count - 1;
                }
            }
            else if (checkbox.IsFromOptions && _indexSetOptionsOffset == -1)
            {
                _indexSetOptionsOffset = _checkboxItems.Count - 1;
            }
        }
 internal void RemoveItem(Checkbox checkbox)
 {
     this._checkboxItems?.Remove(checkbox);
 }
 internal void AddItem(Checkbox checkbox)
 {
     this._checkboxItems ??= new List <Checkbox>();
     this._checkboxItems?.Add(checkbox);
 }