Skip to content

RadioGroupBinding

Defined in: RadioGroupBinding.ts:6, RadioGroupBinding.ts:57

Binding for a group of radio buttons

Key features:

  • Binds a radio button per option, grouped by name
  • Types the options after the getter, and passes the option itself to the setter
  • Supports optional (nullable) values, including a null option
  • Manages error states and ARIA attributes

V extends RadioGroupBinding.Option = RadioGroupBinding.Option

  • FormBinding

ButtonConfig = object

Defined in: RadioGroupBinding.ts:34

Overrides for one radio button of the group

optional id?: string | boolean

Defined in: RadioGroupBinding.ts:42

[Override] ID of the input element.

  • true: Use the field's stable ID as the ID.
  • false: No ID.
  • string: Use the given string as the ID.

optional name?: string

Defined in: RadioGroupBinding.ts:44

[Override] Name attribute of the input element


Config<V> = object

Defined in: RadioGroupBinding.ts:19

V extends RadioGroupBinding.Option = RadioGroupBinding.Option

optional aria-describedby?: Attrs["aria-describedby"]

Defined in: RadioGroupBinding.ts:30

[Extend] IDs of the elements describing the radio buttons; the ID of the error text is added while errors are reported

getter: () => V

Defined in: RadioGroupBinding.ts:21

Get the value from the model

V

optional onChange?: Attrs["onChange"]

Defined in: RadioGroupBinding.ts:26

[Extend] Change handler

optional onFocus?: Attrs["onFocus"]

Defined in: RadioGroupBinding.ts:28

[Extend] Focus handler

setter: (value: V) => void

Defined in: RadioGroupBinding.ts:23

@action

Set the option of the selected radio button to the model

V

void


Option = string | number | boolean | null

Defined in: RadioGroupBinding.ts:17

Value that a radio button of the group stands for

The button's value attribute is its string form, or an empty string for null.

new RadioGroupBinding<V>(field, config): RadioGroupBinding<V>

Defined in: RadioGroupBinding.ts:60

FormField

RadioGroupBinding.Config<V>

RadioGroupBinding<V>

config: RadioGroupBinding.Config<V>

Defined in: RadioGroupBinding.ts:62

FormBinding.config


onFocus: FocusEventHandler<HTMLInputElement>

Defined in: RadioGroupBinding.ts:71


get errorMessages(): string | null

Defined in: RadioGroupBinding.ts:77

string | null

@computed


get value(): V

Defined in: RadioGroupBinding.ts:67

V


props(option, config?): object

Defined in: RadioGroupBinding.ts:82

V

Option that the radio button stands for

RadioGroupBinding.ButtonConfig

object

aria-describedby: string | undefined

aria-errormessage: string | undefined

aria-invalid: boolean | undefined

checked: boolean

id: string | undefined

name: string

onChange: ChangeEventHandler<HTMLInputElement, HTMLInputElement>

onFocus: FocusEventHandler<HTMLInputElement>

type: "radio" = "radio"

value: string

FormBinding.props