-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: added toggle documentation #791
Conversation
@ViewChild('input') | ||
inputElement: ElementRef<HTMLInputElement>; | ||
|
||
/** @Input The size of the toggle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@input is not needed anymore, I upgraded the docs script a week ago or so :)
Deploy preview for fundamental-ngx ready! Built with commit b1dc724 |
@Input() | ||
checked: boolean = false; | ||
|
||
/** @Input aria-label attribute. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify that this is the aria-label of the inner input element
@Input() | ||
ariaLabel: string = null; | ||
|
||
/** @Input aria-labelledby attribute. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specify that this is the aria-labelledby of the inner input element
@Input() | ||
ariaLabelledby: string = null; | ||
|
||
/** @Output Event fired when the toggle is checked. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is fired when the state of the toggle changes, whether it is checked or unchecked. Also explain that $event can be used to retrieve the new state of the toggle
public focus(): void { | ||
this.inputElement.nativeElement.focus(); | ||
} | ||
|
||
/** Get the innerInputId property of the toggle. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe simpler: Get the id of the inner input element of the toggle.
set isChecked(value) { | ||
this.checked = value; | ||
this.onChange(value); | ||
this.onTouched(); | ||
this.checkedChange.emit(value); | ||
} | ||
|
||
/** | ||
* @param value Sets the value of the *checked* property of the toggle. | ||
*/ | ||
writeValue(value: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can add @hidden here since this is only used by angular forms, but keep the description as it could be useful
registerOnTouched(fn) { | ||
this.onTouched = fn; | ||
} | ||
|
||
/** | ||
* @param isDisabled Sets the value of the *disabled* property of the toggle. | ||
*/ | ||
setDisabledState(isDisabled: boolean): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add @hidden here since this is only used by angular forms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Please provide a link to the associated issue.
#696
Please provide a brief summary of this pull request.
Documented Toggle component