Radio button

radio button

Radio Buttons are used when the user must make only one selection out of a group of items. Radio Buttons are generally used in groups describing a set of related options.

Usage

radio button

XelaRadioButtonGroup(
    items: [
        XelaRadioButtonItem(id: "1", label: "Label", caption: "Caption"),
        XelaRadioButtonItem(id: "2", label: "Label", caption: "Caption"),
        XelaRadioButtonItem(id: "3", label: "Label", caption: "Caption"),
        XelaRadioButtonItem(id: "4", label: "Label", caption: "Caption"),
        XelaRadioButtonItem(id: "5", label: "Label", caption: "Caption")
    ],
    itemBorder: false,
    size: .Medium,
    selectedItem: nil
) { selected in
    print("Selected is: "+selected.label)
}

Properties XelaRadioButtonGroup

Name Type Default Value Required Description
items [XelaRadioButtonItem] - YES Array of radio button items
itemBorder Bool false NO Show radio button item border
size XelaRadioButtonSize .Large NO Radio button size (.Large, .Medium, .Small)
selectedColor Color Color(xelaColor: .Blue3) NO Selected color
defaultColor Color Color(xelaColor: .Gray11) NO Default color
selectedItem XelaRadioButtonItem? nil NO Selected radio button item
callback (XelaRadioButtonItem) -> () - YES Callback on select radio button item

Properties XelaRadioButtonItem

Name Type Default Value Required Description
id String - YES Unique id radio button item
label String - YES Label text radio button item, set empty string to hide
caption String - YES Caption text radio button item, set empty string to hide
value String NO value text radio button item, set empty string to hide
state XelaRadioButtonState .Default NO Radio button state (.Default, .Hover, .Selected, .Disabled)