Button-class: Button widget

ButtonR Documentation

Button widget

Description

A focusable button. See button().

Super class

Widget -> Button

Public fields

paint_states

Pressing only repaints.

focusable

Buttons can be focused.

variant

Colour variant.

press_duration

Seconds the pressed state stays visible.

Active bindings

label

The button text (reactive).

pressed

Is the button showing its pressed state?

Methods

Public methods

Inherited methods

Button$new()

Create a button.

Usage
Button$new(
  label = "Button",
  id = NULL,
  classes = NULL,
  style = NULL,
  disabled = FALSE,
  variant = "default"
)
Arguments
label

Button text, or a function of no arguments that returns it (re-evaluated when the signal()s it reads change).

id, classes, style, disabled

See Widget.

variant

One of "default", "primary", "success", "warning", "error".


Button$default_style()

The built-in style.

Usage
Button$default_style()

Button$default_bindings()

Enter and space press the button.

Usage
Button$default_bindings()

Button$render()

The button text.

Usage
Button$render()

Button$press()

Press the button: shows the pressed state briefly and sends a "button.pressed" message. Does nothing when disabled.

Usage
Button$press()
Returns

TRUE if the button was pressed.


Button$on_click()

A left click presses the button.

Usage
Button$on_click(event)
Arguments
event

A MouseEvent.


Button$action_press()

Action used by the default bindings.

Usage
Button$action_press()

Button$pseudo_states()

Active states: focus, disabled and pressed.

Usage
Button$pseudo_states()

Button$clone()

The objects of this class are cloneable with this method.

Usage
Button$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


termr documentation built on Oct. 21, 2026, 5:13 p.m.