igniteui-webcomponents
Version:
Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.
116 lines (115 loc) • 4.88 kB
TypeScript
import { LitElement, type TemplateResult } from 'lit';
import type { Constructor } from '../common/mixins/constructor.js';
export interface IgcButtonEventMap {
focus: FocusEvent;
blur: FocusEvent;
}
declare const IgcButtonBaseComponent_base: Constructor<import("../common/mixins/event-emitter.js").EventEmitterInterface<IgcButtonEventMap>> & Constructor<LitElement>;
/**
* Abstract base class shared by `igc-button` and `igc-icon-button`.
*
* Provides common form-association behavior, link-button rendering
* (renders as `<a>` when `href` is set), keyboard focus-ring management,
* and the Invoker Commands API (`command` / `commandfor`).
*
* Concrete subclasses must implement `_renderContent()` to supply the
* visual content projected inside the native `<button>` or `<a>` element.
*/
export declare abstract class IgcButtonBaseComponent extends IgcButtonBaseComponent_base {
static readonly formAssociated = true;
private readonly _focusRingManager;
private readonly _internals;
private readonly _resolver;
private _disabled;
private _commandfor;
private _commandForElement;
private readonly _nativeButton?;
/**
* The type of the button, which determines its behavior and semantics.
* - `'button'` – no default action; useful for custom JavaScript handlers.
* - `'submit'` – submits the associated form when clicked.
* - `'reset'` – resets the associated form fields to their initial values.
*
* Ignored when the button is rendered as a link (i.e. `href` is set).
* @attr type
* @default 'button'
*/
type: 'button' | 'reset' | 'submit';
/**
* The URL the button points to. When set, the component renders as an
* `<a>` element instead of a `<button>`, enabling navigation on click.
* Use together with `target`, `download`, and `rel` for full anchor semantics.
* @attr href
*/
href?: string;
/**
* Prompts the browser to download the linked resource rather than navigating
* to it. The optional value is used as the suggested file name.
* Only effective when `href` is set.
* @attr download
*/
download?: string;
/**
* Where to open the linked document. Only effective when `href` is set.
* - `'_self'` – current browsing context (default browser behavior).
* - `'_blank'` – new tab or window.
* - `'_parent'` – parent browsing context; falls back to `_self` if none.
* - `'_top'` – top-level browsing context; falls back to `_self` if none.
* @attr target
*/
target?: '_blank' | '_parent' | '_self' | '_top';
/**
* The relationship between the current document and the linked URL.
* Accepts a space-separated list of link types (e.g. `'noopener noreferrer'`).
* Only effective when `href` is set. When `target="_blank"` is used,
* setting `rel="noopener noreferrer"` is strongly recommended for security.
* @attr rel
*/
rel?: string;
/**
* When set, the button will be disabled and non-interactive.
*
* @attr disabled
* @default false
*/
set disabled(value: boolean);
get disabled(): boolean;
/**
* The command to invoke on the target element specified by `commandfor`.
* Part of the [Invoker Commands](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API) API.
* Custom commands must start with two dashes (e.g. `'--my-command'`).
* @attr command
*/
command?: string;
/**
* The ID of the target element for the invoker command.
* Part of the [Invoker Commands API](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API).
* @attr commandfor
*/
set commandfor(value: string | null);
get commandfor(): string | null;
/**
* The target element for the invoker command. Resolved from the `commandfor` ID.
*/
get commandForElement(): Element | null;
set commandForElement(value: Element | null);
/**
* The `<form>` element the button is associated with.
* Resolved through the standard form-association mechanism — either the
* closest ancestor `<form>` or the form referenced by the button's `form`
* attribute. Returns `null` when no form is associated.
* Relevant only when `type` is `'submit'` or `'reset'`.
*/
get form(): HTMLFormElement | null;
protected firstUpdated(): void;
protected _handleClick(): void;
protected formDisabledCallback(state: boolean): void;
private _resolveCommandForElement;
/** Simulates a mouse click on the button, triggering its click handler and any associated form action. */
click(): void;
private _renderButton;
private _renderLinkButton;
protected abstract _renderContent(): TemplateResult;
protected render(): TemplateResult<1>;
}
export {};