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
74 lines (71 loc) • 2 kB
TypeScript
import { TemplateRef } from '@angular/core';
import { PassThroughOption, PassThrough } from 'primeng/api';
/**
* Custom passthrough(pt) options.
* @template I Type of instance.
*
* @see {@link ToggleSwitch.pt}
* @group Interface
*/
interface ToggleSwitchPassThroughOptions<I = unknown> {
/**
* Used to pass attributes to the root's DOM element.
*/
root?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the input's DOM element.
*/
input?: PassThroughOption<HTMLInputElement, I>;
/**
* Used to pass attributes to the slider's DOM element.
*/
slider?: PassThroughOption<HTMLDivElement, I>;
/**
* Used to pass attributes to the handle's DOM element.
*/
handle?: PassThroughOption<HTMLDivElement, I>;
}
/**
* Defines valid pass-through options in ToggleSwitch component.
* @see {@link ToggleSwitchPassThroughOptions}
*
* @template I Type of instance.
*/
type ToggleSwitchPassThrough<I = unknown> = PassThrough<I, ToggleSwitchPassThroughOptions<I>>;
/**
* Custom change event.
* @see {@link ToggleSwitch.onChange}
* @group Events
*/
interface ToggleSwitchChangeEvent {
/**
* Browser event
*/
originalEvent: Event;
/**
* Checked state as a boolean.
*/
checked: boolean;
}
/**
* Custom handle template context.
* @group Interface
*/
interface ToggleSwitchHandleTemplateContext {
/**
* Checked state of the toggle switch.
*/
checked: boolean;
}
/**
* Defines valid templates in ToggleSwitch.
* @group Templates
*/
interface ToggleSwitchTemplates {
/**
* Custom handle template.
* @param {ToggleSwitchHandleTemplateContext} context - handle context.
*/
handle(context: ToggleSwitchHandleTemplateContext): TemplateRef<ToggleSwitchHandleTemplateContext>;
}
export type { ToggleSwitchChangeEvent, ToggleSwitchHandleTemplateContext, ToggleSwitchPassThrough, ToggleSwitchPassThroughOptions, ToggleSwitchTemplates };