class

Opal::UI::Button

Inherits Opal::UI::Control < Opal::UI::InputHookable < Opal::UI::Element < Opal::UI::Themable < Reference < Object

Focusable, interactive Button component supporting styles (:primary, :secondary, :outline, :danger, :success, :ghost), toggle modes, icons, keyboard shortcuts, and mouse clicks.

Constructors

new(label : String, icon : String | Nil = nil, variant : Symbol = :primary, toggle : Bool = false, active : Bool = false, disabled : Bool = false, shortcut_char : Char | Nil = nil, on_click : Proc(Button, Nil) | Nil = nil)
Source
new(label : String, icon : String | Nil = nil, variant : Symbol = :primary, toggle : Bool = false, active : Bool = false, disabled : Bool = false, shortcut_char : Char | Nil = nil, &block : Button -> Nil) : Button
Source

Instance methods

active=(active : Bool)
Source
active?
Source
active_bg
Source
active_bg=(active_bg : Color | Nil)
Source
active_fg
Source
active_fg=(active_fg : Color | Nil)
Source
bg=(bg : Color | Nil)
Source
border_fg
Source
border_fg=(border_fg : Color | Nil)
Source
border_style
Source
border_style=(border_style : Border | Nil)
Source
click

Triggers a button activation/click

Source
disabled=(disabled : Bool)
Source
disabled?
Source
effective_bg
Source
effective_fg
Source
fg

Manipulable theme properties

Source
fg=(fg : Color | Nil)

Manipulable theme properties

Source
handle_key(key : Terminal::KeyEvent) : Bool

Default key event handler. Override in subclasses if not using @default_input_proc.

Source
handle_mouse(event : Terminal::MouseEvent) : Bool

Default mouse event handler. Override in subclasses if not using @default_input_proc.

Source
hover_bg
Source
hover_bg=(hover_bg : Color | Nil)
Source
hover_fg
Source
hover_fg=(hover_fg : Color | Nil)
Source
icon
Source
icon=(icon : String | Nil)
Source
label
Source
label=(label : String)
Source
on_click
Source
on_click
Source
on_click=(on_click : Proc(Button, Nil) | Nil)
Source
preferred_size(available_w : Int32, available_h : Int32) : Tuple(Int32, Int32)
Source
render(buffer : Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil
Source
shortcut_char
Source
shortcut_char=(shortcut_char : Char | Nil)
Source
toggle=(toggle : Bool)
Source
toggle?
Source
variant
Source
variant=(variant : Symbol)
Source