Matterway
    Preparing search index...

    Function radioList

    • Radio list component for single selection from multiple options.

      Parameters

      • props: UiRadioListFieldProps

        Configuration object

        • name

          Name of the component

        • label

          Label text

        • items

          Array of options

        • defaultValue

          Default selected value

        • required

          If true, the field is required

        • disabled

          If true, the field is disabled

        • invalid

          If false/undefined the field is valid. If a string is provided, it will be used as the validation message

      Returns Element

      Basic usage with required props

      radioList({
      name: 'gender',
      label: 'Gender',
      items: [
      { value: 'male', label: 'Male' },
      { value: 'female', label: 'Female' },
      { value: 'other', label: 'Other' }
      ]
      });

      Usage with default value

      radioList({
      name: 'preferredContact',
      label: 'Preferred Contact Method',
      items: [
      { value: 'email', label: 'Email' },
      { value: 'phone', label: 'Phone' },
      { value: 'mail', label: 'Mail' }
      ],
      defaultValue: 'email',
      required: true,
      disabled: false
      });

      Usage with dynamic items depending on other fields

      radioList({
      name: 'food',
      label: 'Food',
      items: async ({data}) =>
      data.country === 'us'
      ? [{value: 'burger', label: 'Burger'}, {value: 'fries', label: 'Fries'}]
      : [{value: 'pasta', label: 'Pasta'}, {value: 'pizza', label: 'Pizza'}, {value: 'salad', label: 'Salad'}],
      });