Radiobutton class
📖 Description
The Radiobutton class defines a radiobutton control for the Tripetto builder. It is derived from the DataControl class.
📺 Preview

🆕 constructor
Creates a new Radiobutton instance.
Signature
constructor(buttons: IButton[], value: any | Binding, style?: IRadiobuttonStyle): Radiobutton
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
buttons | IButton[] | No | Specifies the radiobuttons. |
value | any | Binding | No | Specifies the initially selected value or a data binding created with bind. |
style | IRadiobuttonStyle | Yes | Specifies the style (when omitted the default global style will be used). |
Return value
Returns a reference to the new Radiobutton instance.
📌 Statics
🏷️ style
Contains the global default style for the radiobutton control.
Type
🔧 bind
Binds an object property to the control allowing its value to update automatically when the value of the control changes. If the control is disabled or invisible, the supplied valueWhenInactive is automatically set as the property value. When a control is enabled and visible, the supplied defaultWhenActive is set automatically if the property value is currently not defined.
Signature
bind<Target, P extends keyof Target>(
target: Target,
property: P,
valueWhenInactive: any,
defaultWhenActive?: any,
modifier?: (value?: any) => any
): Binding;
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
target | Target | No | Reference to the target object which contains the property. |
property | P | No | Specifies the name of the property. |
valueWhenInactive | any | No | Specifies the value which is set to the property when the control is inactive (disabled or invisible). |
defaultWhenActive | any | Yes | Specifies the default (initial) value that will be used when the control is active (enabled and visible). |
modifier | (value?: any) => any | Yes | Specifies a modifier function for the data. |
Return value
Returns a Binding instance that can be used in the controls constructor to bind a value to a control.
Example
import { Forms } from "@tripetto/builder";
const example = {
selected: "a"
};
const radiobutton = new Forms.Radiobutton(
[
{
label: "Option A",
value: "a"
},
{
label: "Option B",
value: "b"
},
{
label: "Option C",
value: "c"
}
],
Forms.Radiobutton.bind(example, "selected", "a"));
🗃️ Fields
🏷️ hasFocus
Retrieves if the control has input focus.
Type
boolean
🏷️ isDisabled
Sets or retrieves if the control is disabled.
Type
boolean
🏷️ isLocked
Sets or retrieves if the control is locked (readonly).
Type
boolean
🏷️ isObservable
Retrieves if the control is observable.
Type
boolean
🏷️ isRequired
Sets or retrieves if the control is required.
Type
boolean
🏷️ isVisible
Sets or retrieves the visibility of the control.
Type
boolean
🏷️ style
Contains the radiobutton control style.
Type
🏷️ value
Sets or retrieves the selected value.
Type
any
▶️ Methods
🔧 blur
Blurs the focus of the control.
Signature
blur(): void