primeng
Version:
PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB
137 lines (136 loc) • 5.29 kB
TypeScript
import { AfterContentInit, EventEmitter, QueryList, TemplateRef } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { PrimeTemplate } from 'primeng/api';
import { BaseComponent } from 'primeng/basecomponent';
import { Nullable } from 'primeng/ts-helpers';
import { ToggleButtonStyle } from './style/togglebuttonstyle';
import { ToggleButtonChangeEvent } from './togglebutton.interface';
import * as i0 from "@angular/core";
import * as i1 from "primeng/api";
export declare const TOGGLEBUTTON_VALUE_ACCESSOR: any;
/**
* ToggleButton is used to select a boolean value using a button.
* @group Components
*/
export declare class ToggleButton extends BaseComponent implements AfterContentInit, ControlValueAccessor {
/**
* Label for the on state.
* @group Props
*/
onLabel: string;
/**
* Label for the off state.
* @group Props
*/
offLabel: string;
/**
* Icon for the on state.
* @group Props
*/
onIcon: string | undefined;
/**
* Icon for the off state.
* @group Props
*/
offIcon: string | undefined;
/**
* Defines a string that labels the input for accessibility.
* @group Props
*/
ariaLabel: string | undefined;
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
* @group Props
*/
ariaLabelledBy: string | undefined;
/**
* When present, it specifies that the element should be disabled.
* @group Props
*/
disabled: boolean | undefined;
/**
* Inline style of the element.
* @group Props
*/
style: any;
/**
* Style class of the element.
* @group Props
*/
styleClass: string | undefined;
get hostClass(): string;
/**
* Identifier of the focus input to match a label defined for the component.
* @group Props
*/
inputId: string | undefined;
/**
* Index of the element in tabbing order.
* @group Props
*/
tabindex: number | undefined;
/**
* Defines the size of the component.
* @group Props
*/
size: 'large' | 'small';
/**
* Position of the icon.
* @group Props
*/
iconPos: 'left' | 'right';
/**
* When present, it specifies that the component should automatically get focus on load.
* @group Props
*/
autofocus: boolean | undefined;
/**
* Whether selection can not be cleared.
* @group Props
*/
allowEmpty: boolean | undefined;
/**
* Callback to invoke on value change.
* @param {ToggleButtonChangeEvent} event - Custom change event.
* @group Emits
*/
onChange: EventEmitter<ToggleButtonChangeEvent>;
/**
* Custom icon template.
* @group Templates
*/
iconTemplate: Nullable<TemplateRef<any>>;
/**
* Custom content template.
* @group Templates
*/
contentTemplate: Nullable<TemplateRef<any>>;
templates: QueryList<PrimeTemplate>;
checked: boolean;
onModelChange: Function;
onModelTouched: Function;
_componentStyle: ToggleButtonStyle;
toggle(event: Event): void;
onKeyDown(event: KeyboardEvent): void;
onBlur(): void;
writeValue(value: any): void;
registerOnChange(fn: Function): void;
registerOnTouched(fn: Function): void;
setDisabledState(val: boolean): void;
get hasOnLabel(): boolean;
get hasOffLabel(): boolean;
get active(): boolean;
_iconTemplate: TemplateRef<any> | undefined;
_contentTemplate: TemplateRef<any> | undefined;
ngAfterContentInit(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ToggleButton, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ToggleButton, "p-toggleButton, p-togglebutton, p-toggle-button", never, { "onLabel": { "alias": "onLabel"; "required": false; }; "offLabel": { "alias": "offLabel"; "required": false; }; "onIcon": { "alias": "onIcon"; "required": false; }; "offIcon": { "alias": "offIcon"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "style": { "alias": "style"; "required": false; }; "styleClass": { "alias": "styleClass"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; "size": { "alias": "size"; "required": false; }; "iconPos": { "alias": "iconPos"; "required": false; }; "autofocus": { "alias": "autofocus"; "required": false; }; "allowEmpty": { "alias": "allowEmpty"; "required": false; }; }, { "onChange": "onChange"; }, ["iconTemplate", "contentTemplate", "templates"], never, true, never>;
static ngAcceptInputType_disabled: unknown;
static ngAcceptInputType_tabindex: unknown;
static ngAcceptInputType_autofocus: unknown;
}
export declare class ToggleButtonModule {
static ɵfac: i0.ɵɵFactoryDeclaration<ToggleButtonModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<ToggleButtonModule, never, [typeof ToggleButton, typeof i1.SharedModule], [typeof ToggleButton, typeof i1.SharedModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<ToggleButtonModule>;
}