Skip to content

checkbox-list

Multi-select checkbox group bound to an ARRAY attribute.

Builder F.checkboxList(attribute: string): CheckboxList
Wire type key checkbox-list
Class chain CheckboxListChoiceFieldField
Detail projection text-entry
Column counterpart text cell, i.e. C.text(attribute)

::: tip The projection is a per-instance decision badge-entry for a coloured option set, text-entry otherwise (protocol §8). :::

Example

import { F } from '@adonia/core'

F.checkboxList('permissions')
  .options({ read: 'Read', write: 'Write', admin: 'Admin' })
  .columns(3)
  .minSelected(1)

Props

Beyond the shared field DSL:

Prop Declared on Behaviour
columns(count: number): this CheckboxList Lays the checkboxes out in count columns (default: one per row).
minSelected(count: number): this CheckboxList Minimum number of checked options; compiles to the array’s minLength. Spelled minSelected rather than reusing the base’s minLength so the wire prop cannot be mistaken for a STRING length by a client rendering the same key on a text input.
maxSelected(count: number): this CheckboxList Maximum number of checked options; compiles to the array’s maxLength.
options(input: OptionsInput): this ChoiceField Declares the static option list (§7.3 options()).

Introspection

Read-only members this type adds — used by the compiler, the table derivation and tests rather than by a schema author.

Member Declared on Behaviour
get declaredOptions(): readonly FieldOption[] ChoiceField The declared static options, in declaration order.
get optionValues(): ChoiceValue[] ChoiceField The declared option values — the §11.1 enum members.
get hasColoredOptions(): boolean ChoiceField Whether any declared option carries a colour. The single input to the badge-entry/badge projection decision (protocol §8, §7.5).
get displayType(): string ChoiceField badge-entry for a coloured option set, text-entry otherwise (protocol §8).
get columnType(): string | undefined ChoiceField badge cell for a coloured option set, text otherwise (§7.5).
detailProps(): JsonObject ChoiceField Chrome plus the value→presentation maps the chosen entry needs (protocol §8).

Validation

Vine base: vine.string(), vine.enum(this.optionValues).

§11.1 mapping: vine.array(vine.enum(options)) with the declared selection-count bounds.

Contributed by CheckboxList.vineSchema() in packages/core/src/schema/fields/checkbox_list.ts. The shared modifiers (required, nullable, requiredWhen, unique, optionality) are applied on top by Field.buildValidation, and a rules() override replaces the base entirely — the validator compiler never branches on the field class.

Declared in

  • packages/core/src/schema/fields/checkbox_list.tsCheckboxList
  • packages/core/src/schema/fields/choice.tsChoiceField
Navigation

Type to search…

↑↓ navigate↵ selectEsc close