abstract class
Opal::UI::Element
- Opal::UI::Element
- Reference
- Object
Overview
Base class for all visual components in the declarative UI hierarchy.
Included Modules
Direct Known Subclasses
- Opal::UI::AsciiImage
- Opal::UI::AsyncMarkdownViewer
- Opal::UI::AsyncMermaidViewer
- Opal::UI::Badge
- Opal::UI::BarChart
- Opal::UI::BinaryMetrics
- Opal::UI::Box
- Opal::UI::Canvas2D
- Opal::UI::Control
- Opal::UI::Digits
- Opal::UI::Footer
- Opal::UI::Gauge
- Opal::UI::Group
- Opal::UI::Header
- Opal::UI::HStack
- Opal::UI::HTMLBrowser
- Opal::UI::ImageView
- Opal::UI::LineGraph
- Opal::UI::Link
- Opal::UI::LoadingIndicator
- Opal::UI::MarkdownElement
- Opal::UI::MaskContainer
- Opal::UI::MermaidViewer
- Opal::UI::Meter
- Opal::UI::PieChart
- Opal::UI::Placeholder
- Opal::UI::Rule
- Opal::UI::ScissorContainer
- Opal::UI::Sparkline
- Opal::UI::SplitView
- Opal::UI::Text
- Opal::UI::Viewport
- Opal::UI::VStack
Defined in:
opal/ui/element.crInstance Method Summary
- #add_class(name : String) : self
-
#children : Array(Element)
Returns child elements for hierarchical tree traversal and DOM querying
- #classes : Set(String)
- #classes=(classes : Set(String))
- #has_class?(name : String) : Bool
- #id : String | Nil
- #id=(id : String | Nil)
-
#preferred_print_size(available_w : Int32) : Tuple(Int32, Int32)
Returns the preferred size for one-shot print mode rendering, where height should expand to fit all content rather than clamping to viewport rows.
- #preferred_size(available_w : Int32, available_h : Int32) : Tuple(Int32, Int32)
-
#print(io : IO = STDOUT, width : Int32 | Nil = nil, color : Bool | Nil = nil, theme : Theme | Nil = nil) : Nil
Prints the element directly to an IO stream in one-shot print mode.
-
#query(selector : String) : Array(Element)
Queries all descendants matching a CSS-like selector string
-
#query(klass : T.class) : Array(T) forall T
Queries all descendants matching a specific Crystal type class
-
#query_one(selector : String) : Element
Queries the first descendant matching selector, or raises KeyError
-
#query_one(klass : T.class) : T forall T
Queries the first descendant matching type class, or raises KeyError
-
#query_one?(selector : String) : Element | Nil
Queries the first descendant matching selector, or nil
-
#query_one?(klass : T.class) : T | Nil forall T
Queries the first descendant matching type class, or nil
- #remove_class(name : String) : self
- #render(buffer : Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil
-
#render_print(buffer : Buffer, width : Int32, height : Int32) : Nil
Print-mode rendering hook that components can override if their print layout differs from interactive layout
-
#to_print_s(width : Int32 | Nil = nil, color : Bool | Nil = nil, theme : Theme | Nil = nil) : String
Renders the element into a string buffer in one-shot print mode.
-
#to_string(width : Int32 | Nil = nil, color : Bool | Nil = nil, theme : Theme | Nil = nil) : String
Alias for to_print_s
Instance methods inherited from module Opal::UI::Themable
current_theme : Theme
current_theme,
style(&block : self -> Nil) : self
style,
theme : Theme | Nil
theme,
theme=(theme : Theme | Nil)
theme=,
with_theme(new_theme : Theme | Symbol | String) : self
with_theme
Instance Method Detail
Returns child elements for hierarchical tree traversal and DOM querying
Returns the preferred size for one-shot print mode rendering, where height should expand to fit all content rather than clamping to viewport rows.
Prints the element directly to an IO stream in one-shot print mode.
Queries all descendants matching a CSS-like selector string
Queries all descendants matching a specific Crystal type class
Queries the first descendant matching selector, or raises KeyError
Queries the first descendant matching type class, or raises KeyError
Queries the first descendant matching selector, or nil
Queries the first descendant matching type class, or nil
Print-mode rendering hook that components can override if their print layout differs from interactive layout
Renders the element into a string buffer in one-shot print mode. If color is nil, auto-detects from TTY and NO_COLOR environment variable.