checkbox/src/checkbox/checkbox.component.ts
<talenra-checkbox> is an on/off control.
Other than a native checkbox element, <talenra-checkbox> keeps value and checked
properties in sync (both are either true or false).
If property indeterminate is set true, the checkbox is presented in "mixed" state,
regardless of its value or checked state.
// Component class
sampleForm: FormGroup = new FormGroup({
rememberMe: new FormControl(true),
disabledCheckbox: new FormControl({ value: false, disabled: true }),
});<!-- Component template -->
<form [formGroup]="sampleForm">
<talenra-checkbox formControlName="rememberMe" label="Remember me" />
<talenra-checkbox formControlName="disabledCheckbox" label="Toggle (disabled)" />
</form>// Import `FormsModule` in the declaring module
import { FormsModule } from '@angular/forms';
@NgModule({
// ...
imports: [FormsModule],
})// Component class
sampleValue = true;<!-- Component template -->
<form #templateDrivenForm="ngForm">
<talenra-checkbox name="sampleValue" [(ngModel)]="sampleValue" label="Sample value" />
</form>// Component class
sampleValue = true;<!-- Component template -->
<talenra-checkbox [(ngModel)]="sampleValue" label="Sample value" />import { CheckboxComponent } from '@talenra/components/checkbox';
ControlValueAccessor
OnInit
AfterViewInit
| changeDetection | ChangeDetectionStrategy.OnPush |
| host | { |
| providers |
)
|
| selector | talenra-checkbox |
| styleUrls | ./checkbox.component.scss |
| templateUrl | ./checkbox.component.html |
Inputs |
Outputs |
Accessors |
| indeterminate |
Type : boolean
|
|
The control's indeterminate state. "Indeterminate" means it is not possible to say whether the control is checked or unchecked. Check the MDN docs for more information and a use-case. The checkbox is presented in "mixed" state while |
| pointerDisabled |
Type : boolean
|
Default value : false
|
|
Disables handling of click events while the visual appearance of Checkbox is not modified (other than |
| labelPosition |
Type : TCheckboxLabelPosition
|
Default value : CheckboxLabelPosition.After
|
|
Determines whether the label is displayed before or after the checkbox. Example : |
| size |
Type : TCheckboxSize
|
Default value : CheckboxSize.M
|
|
Determines the size of the rendered checkbox. Example : |
| checked |
Type : boolean
|
|
Determines whether the control is checked. Note: Typically the |
| value |
Type : boolean
|
|
The native element's value attribute. Setting the value will update the checked
state of the control ( Note: A native checkbox element's value and checked state do not neccessarily align.
However, the on-off-controls in this library (e.g. |
| label |
Type : string
|
Default value : ''
|
|
Label displayed to the user. |
| disabled |
Type : boolean
|
|
Determinates whether the control is en-/disabled. |
| formControlName |
Type : string
|
Default value : ''
|
|
Name of the corresponding |
| readonly |
Type : boolean, unknown
|
Default value : false, { transform: booleanAttribute }
|
|
Determines whether the control is readonly. |
| checkedChange |
Type : EventEmitter<CheckboxChange>
|
|
Event emitted when the checkbox's |
| indeterminateChange |
Type : EventEmitter
|
|
Event emitted when the checkbox's |
| indeterminate | ||||||
getindeterminate()
|
||||||
|
The control's indeterminate state. "Indeterminate" means it is not possible to say whether the control is checked or unchecked. Check the MDN docs for more information and a use-case. The checkbox is presented in "mixed" state while |
||||||
setindeterminate(value: boolean)
|
||||||
|
Set the control's indeterminate state.
Parameters :
Returns :
void
|