diff --git a/components/lib/togglebutton/ToggleButton.d.ts b/components/lib/togglebutton/ToggleButton.d.ts index 258dc75ac..325035212 100755 --- a/components/lib/togglebutton/ToggleButton.d.ts +++ b/components/lib/togglebutton/ToggleButton.d.ts @@ -20,6 +20,7 @@ export interface ToggleButtonPassThroughMethodOptions { instance: any; props: ToggleButtonProps; state: ToggleButtonState; + context: ToggleButtonContext; } /** @@ -66,11 +67,32 @@ export interface ToggleButtonPassThroughAttributes { */ export interface ToggleButtonState { /** - * Focused state as a number. + * Focused state as a boolean. */ focused: boolean; } +/** + * Defines current options in ToggleButton component. + */ +export interface ToggleButtonContext { + /** + * Current focused state as a boolean. + * @defaultValue false + */ + focused: boolean; + /** + * Current disabled state as a boolean. + * @defaultValue false + */ + disabled: boolean; + /** + * Current highlighted state as a boolean. + * @defaultValue false + */ + highlighted: boolean; +} + /** * Defines valid properties in ToggleButton component. */ diff --git a/components/lib/togglebutton/ToggleButton.vue b/components/lib/togglebutton/ToggleButton.vue index 499afbd31..d79aa9f5e 100755 --- a/components/lib/togglebutton/ToggleButton.vue +++ b/components/lib/togglebutton/ToggleButton.vue @@ -1,5 +1,5 @@ @@ -87,6 +87,15 @@ export default { }, label() { return this.hasLabel ? (this.modelValue ? this.onLabel : this.offLabel) : ' '; + }, + ptOptions() { + return { + context: { + focused: this.focused, + disabled: this.disabled, + highlighted: this.modelValue === true + } + }; } }, directives: {