2023-03-01 11:19:19 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* ToggleButton is used to select a boolean value using a button.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/togglebutton/)
|
|
|
|
*
|
|
|
|
* @module togglebutton
|
|
|
|
*
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
import { InputHTMLAttributes } from 'vue';
|
|
|
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
|
|
|
2023-03-01 11:19:19 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in ToggleButton component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ToggleButtonProps {
|
|
|
|
/**
|
|
|
|
* Value of the component.
|
2023-03-01 11:19:19 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
modelValue?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Icon for the on state.
|
|
|
|
*/
|
|
|
|
onIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Icon for the off state.
|
|
|
|
*/
|
|
|
|
offIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Label for the on state.
|
2023-03-01 11:19:19 +00:00
|
|
|
* @defaultValue yes
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
onLabel?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Label for the off state.
|
2023-03-01 11:19:19 +00:00
|
|
|
* @defaultValue no
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
offLabel?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Position of the icon.
|
2023-03-03 08:18:55 +00:00
|
|
|
* @defaultValue 'left'
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 11:19:19 +00:00
|
|
|
iconPos?: 'left' | 'right' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* When present, it specifies that the element should be disabled.
|
2023-03-01 11:19:19 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
disabled?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Index of the element in tabbing order.
|
|
|
|
*/
|
|
|
|
tabindex?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Identifier of the focus input to match a label defined for the chips.
|
|
|
|
*/
|
|
|
|
inputId?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Style class of the input field.
|
|
|
|
*/
|
|
|
|
inputClass?: any | undefined;
|
|
|
|
/**
|
|
|
|
* Inline style of the input field.
|
|
|
|
*/
|
|
|
|
inputStyle?: any | undefined;
|
|
|
|
/**
|
|
|
|
* Uses to pass all properties of the HTMLInputElement to the focusable input element inside the component.
|
|
|
|
*/
|
|
|
|
inputProps?: InputHTMLAttributes | undefined;
|
|
|
|
/**
|
|
|
|
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
|
|
|
*/
|
|
|
|
'aria-labelledby'?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Establishes a string value that labels the component.
|
|
|
|
*/
|
|
|
|
'aria-label'?: string | undefined;
|
|
|
|
}
|
|
|
|
|
2023-03-01 11:19:19 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in ToggleButton component.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
export interface ToggleButtonSlots {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 11:19:19 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in ToggleButton component.
|
|
|
|
*/
|
|
|
|
export interface ToggleButtonEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the value changes.
|
|
|
|
* @param {boolean} value - New value.
|
|
|
|
*/
|
2023-03-01 11:19:19 +00:00
|
|
|
'update:modelValue'(value: boolean): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke on value change.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
2023-03-01 11:19:19 +00:00
|
|
|
change(event: Event): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the component receives focus.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
2023-03-01 11:19:19 +00:00
|
|
|
focus(event: Event): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the component loses focus.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
2023-03-01 11:19:19 +00:00
|
|
|
blur(event: Event): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 11:19:19 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - ToggleButton**
|
|
|
|
*
|
|
|
|
* _ToggleButton is used to select a boolean value using a button._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/togglebutton/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 11:19:19 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class ToggleButton extends ClassComponent<ToggleButtonProps, ToggleButtonSlots, ToggleButtonEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
ToggleButton: GlobalComponentConstructor<ToggleButton>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ToggleButton;
|