Skip to content

RadioGroupBinding

Defined in: RadioGroupBinding.ts:5, RadioGroupBinding.ts:54

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:31

Overrides for one radio button of the group

optional id?: string | boolean

Defined in: RadioGroupBinding.ts:39

[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:41

[Override] Name attribute of the input element


Config<V> = object

Defined in: RadioGroupBinding.ts:18

V extends RadioGroupBinding.Option = RadioGroupBinding.Option

getter: () => V

Defined in: RadioGroupBinding.ts:20

Get the value from the model

V

optional onChange?: Attrs["onChange"]

Defined in: RadioGroupBinding.ts:25

[Extend] Change handler

optional onFocus?: Attrs["onFocus"]

Defined in: RadioGroupBinding.ts:27

[Extend] Focus handler

setter: (value: V) => void

Defined in: RadioGroupBinding.ts:22

@action

Set the option of the selected radio button to the model

V

void


Option = string | number | boolean | null

Defined in: RadioGroupBinding.ts:16

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:57

FormField

RadioGroupBinding.Config<V>

RadioGroupBinding<V>

config: RadioGroupBinding.Config<V>

Defined in: RadioGroupBinding.ts:59

FormBinding.config


onFocus: FocusEventHandler<HTMLInputElement>

Defined in: RadioGroupBinding.ts:68


get errorMessages(): string | null

Defined in: RadioGroupBinding.ts:74

string | null

@computed


get value(): V

Defined in: RadioGroupBinding.ts:64

V


props(option, config?): object

Defined in: RadioGroupBinding.ts:79

V

Option that the radio button stands for

RadioGroupBinding.ButtonConfig

object

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