Class: Plushie::Widget::ComboBox
- Inherits:
-
Object
- Object
- Plushie::Widget::ComboBox
- Defined in:
- lib/plushie/widget/combo_box.rb
Overview
Combo box -- searchable dropdown with free-form text input.
Props:
- options (array of strings) -- available choices.
- selected (string|nil) -- currently selected value.
- placeholder (string) -- placeholder text.
- width (length) -- widget width.
- padding (number|hash) -- internal padding.
- size (number) -- text size in pixels.
- font (string|hash) -- font specification.
- line_height (number|hash) -- text line height.
- menu_height (number) -- max dropdown menu height in pixels.
- icon (hash) -- icon inside the text input.
- on_option_hovered (boolean) -- emit option hover events.
- on_open (boolean) -- emit open event.
- on_close (boolean) -- emit close event.
- shaping (symbol) -- text shaping strategy.
- ellipsis (string) -- text ellipsis strategy.
- menu_style (hash) -- dropdown menu style overrides.
- style (symbol|hash) -- named style or style map.
- a11y (hash) -- accessibility overrides.
Constant Summary collapse
- PROPS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Supported property keys for this widget.
%i[options selected placeholder width padding size font line_height menu_height icon on_option_hovered on_open on_close shaping ellipsis menu_style style a11y].freeze
Instance Attribute Summary collapse
-
#a11y ⇒ Object
readonly
Returns the value of attribute a11y.
-
#ellipsis ⇒ Object
readonly
Returns the value of attribute ellipsis.
-
#font ⇒ Object
readonly
Returns the value of attribute font.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#line_height ⇒ Object
readonly
Returns the value of attribute line_height.
-
#menu_height ⇒ Object
readonly
Returns the value of attribute menu_height.
-
#menu_style ⇒ Object
readonly
Returns the value of attribute menu_style.
-
#on_close ⇒ Object
readonly
Returns the value of attribute on_close.
-
#on_open ⇒ Object
readonly
Returns the value of attribute on_open.
-
#on_option_hovered ⇒ Object
readonly
Returns the value of attribute on_option_hovered.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#padding ⇒ Object
readonly
Returns the value of attribute padding.
-
#placeholder ⇒ Object
readonly
Returns the value of attribute placeholder.
-
#selected ⇒ Object
readonly
Returns the value of attribute selected.
-
#shaping ⇒ Object
readonly
Returns the value of attribute shaping.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #build ⇒ Plushie::Node
-
#initialize(id, options = [], **opts) ⇒ ComboBox
constructor
A new instance of ComboBox.
Constructor Details
#initialize(id, options = [], **opts) ⇒ ComboBox
Returns a new instance of ComboBox.
45 46 47 48 49 50 |
# File 'lib/plushie/widget/combo_box.rb', line 45 def initialize(id, = [], **opts) @id = id.to_s @options = PROPS.each { |k| instance_variable_set(:"@#{k}", opts[k]) if opts.key?(k) } @options = opts[:options] if opts.key?(:options) end |
Instance Attribute Details
#a11y ⇒ Object (readonly)
Returns the value of attribute a11y.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def a11y @a11y end |
#ellipsis ⇒ Object (readonly)
Returns the value of attribute ellipsis.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def ellipsis @ellipsis end |
#font ⇒ Object (readonly)
Returns the value of attribute font.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def font @font end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def icon @icon end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def id @id end |
#line_height ⇒ Object (readonly)
Returns the value of attribute line_height.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def line_height @line_height end |
#menu_height ⇒ Object (readonly)
Returns the value of attribute menu_height.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def @menu_height end |
#menu_style ⇒ Object (readonly)
Returns the value of attribute menu_style.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def @menu_style end |
#on_close ⇒ Object (readonly)
Returns the value of attribute on_close.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def on_close @on_close end |
#on_open ⇒ Object (readonly)
Returns the value of attribute on_open.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def on_open @on_open end |
#on_option_hovered ⇒ Object (readonly)
Returns the value of attribute on_option_hovered.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def on_option_hovered @on_option_hovered end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def @options end |
#padding ⇒ Object (readonly)
Returns the value of attribute padding.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def padding @padding end |
#placeholder ⇒ Object (readonly)
Returns the value of attribute placeholder.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def placeholder @placeholder end |
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def selected @selected end |
#shaping ⇒ Object (readonly)
Returns the value of attribute shaping.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def shaping @shaping end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def size @size end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def style @style end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
1 2 3 |
# File 'lib/plushie/widget/combo_box.rb', line 1 def width @width end |