Class: Button

mvcomponents/button. Button

Renderiza um botão simples.


new Button( [label])

Parameters:
Name Type Argument Default Description
label string <optional>
null

Rótulo do Button.

Example
import {Button} from "mvcomponents/button";
import {EBasicColorStatus} from "mvcomponents/component";

let button:Button = new Button("Label")
    .setIcon("mv-basico-adicionar")
    .setColor(EBasicColorStatus.DANGER)
    .setLabel("Modificar Label")
    .setTooltip("Tooltip do Button");

this.append(button);

Extends

Methods


addEvent(type, handler)

Adiciona um novo listener ao componente

Parameters:
Name Type Description
type EMouseEvent | EKeyboardEvent
handler function
Inherited From:

removeAllEvents( [callback])

Remove todos os listeners de um elemento

Parameters:
Name Type Argument Description
callback function <optional>
Inherited From:

removeEvent(type, handler)

Remove um listener do objeto

Parameters:
Name Type Description
type EMouseEvent | EKeyboardEvent
handler function
Inherited From:

setColor(color)

Informa a cor do botão.

Obs.: Utiliza o EBasicColorStatus do grupo 'mvcomponents/component' para definir a cor do Button.

Parameters:
Name Type Description
color EBasicColorStatus

EBasicColorStatus do grupo 'mvcomponents/component' para definir a cor do Button

Returns:
Type
Button
Example
let button1:Button = new Button("DANGER").setColor(EBasicColorStatus.DANGER);
let button2:Button = new Button("SUCCESS").setColor(EBasicColorStatus.SUCCESS);
let button3:Button = new Button("INFO").setColor(EBasicColorStatus.INFO);
let button4:Button = new Button("PRIMARY").setColor(EBasicColorStatus.PRIMARY);
let button5:Button = new Button("WARNING").setColor(EBasicColorStatus.WARNING);

setIcon(psrc)

Altera o icone que será exibido pelo Button.

Parameters:
Name Type Description
psrc string

Icone que será exibido.

Returns:
Type
Button
Example
let button1:Button = new Button("com mv-icons").setIcon("mv-hosp-pertences");
let button2:Button = new Button("").setIcon("mv-basico-adicionar");

setLabel(label)

Atribui ou substitui o rótulo do Button

Parameters:
Name Type Description
label string

Texto que deve substituir a label do Button.

Returns:
Type
Button
Example
let button:Button = new Button("Label Original");
button.setLabel("Label Modificado");

setTooltip(tooltip)

Atribui ou substitui o Tooltip do Button

Parameters:
Name Type Description
tooltip string

Texto que deve ser exibido no Tooltip.

Returns:
Type
Button
Example
let button:Button = new Button("tooltip");
button.setTooltip('Tooltip do button');