Skip to content

select

Dropdown bound to a scalar attribute, or — after multiple() — to an array attribute.

Builder F.select(attribute: string): Select
Wire type key select
Class chain SelectChoiceFieldField
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.select('status')
  .options([
    { value: 'draft', label: 'Draft', color: 'gray' },
    { value: 'published', label: 'Published', color: 'green' },
  ])
  .required()

F.select('tags').options({ news: 'News', howto: 'How-to' }).multiple().native()

Props

Beyond the shared field DSL:

Prop Declared on Behaviour
multiple(): this Select Allows several selections (§7.3 multiple()). The form state becomes an array, and §11.1’s vine.enum is lifted into vine.array(vine.enum).
native(): this Select Renders the platform <select> instead of the custom listbox (§7.3 native()). Purely presentational — validation and state are identical.
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 isMultiple(): boolean Select Whether this select accepts several values.
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.enum(options), or vine.array(vine.enum(options)) when multiple(). Selection COUNT bounds are F.checkboxList’s minSelected/maxSelected; a select constrains membership only.

Contributed by Select.vineSchema() in packages/core/src/schema/fields/select.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/select.tsSelect
  • packages/core/src/schema/fields/choice.tsChoiceField
Navigation

Type to search…

↑↓ navigate↵ selectEsc close