Skip to content

radio

Exclusive radio group bound to a scalar attribute — a select whose options are all visible at once, so it carries the same §11.1 enum mapping and differs only in layout.

Builder F.radio(attribute: string): Radio
Wire type key radio
Class chain RadioChoiceFieldField
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.radio('visibility')
  .options({ public: 'Public', private: 'Private' })
  .inline()
  .required()

Props

Beyond the shared field DSL:

Prop Declared on Behaviour
inline(): this Radio Lays the options out on one row instead of stacking them.
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.enum(options).

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

Type to search…

↑↓ navigate↵ selectEsc close