@playcanvas/pcui
Version:
User interface component library for the web
64 lines (63 loc) • 2.03 kB
TypeScript
import { Element, ElementArgs, IBindable, IBindableArgs, IFlexArgs, IPlaceholder, IPlaceholderArgs } from '../Element';
/**
* The arguments for the {@link Label} constructor.
*/
interface LabelArgs extends ElementArgs, IBindableArgs, IPlaceholderArgs, IFlexArgs {
/**
* Sets the text of the Label. Defaults to ''.
*/
text?: string;
/**
* If `true`, the {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML innerHTML} property will be
* used to set the text. Otherwise, {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent textContent}
* will be used instead. Defaults to `false`.
*/
unsafe?: boolean;
/**
* If `true` then use the text of the label as the native HTML tooltip. Defaults to `false`.
*/
nativeTooltip?: boolean;
/**
* If `true` then the label can be clicked to select text. Defaults to `false`.
*/
allowTextSelection?: boolean;
/**
* The DOM element or its type to use for this component. Defaults to 'span'.
*/
dom?: HTMLElement | string;
/**
* Sets the value of the Label. Defaults to ''.
*/
value?: string;
}
/**
* The Label is a simple span element that displays some text.
*/
declare class Label extends Element implements IPlaceholder, IBindable {
protected _unsafe: boolean;
protected _text: string;
protected _renderChanges: boolean;
/**
* Creates a new Label.
*
* @param args - The arguments.
*/
constructor(args?: Readonly<LabelArgs>);
protected _updateText(value: string): boolean;
/**
* Sets the text of the Label.
*/
set text(value: string);
/**
* Gets the text of the Label.
*/
get text(): string;
set value(value: string);
get value(): string;
set values(values: string[]);
set placeholder(value: string);
get placeholder(): string;
set renderChanges(value: boolean);
get renderChanges(): boolean;
}
export { Label, LabelArgs };