Class: NitroKit::Flex
- Defined in:
- app/components/nitro_kit/flex.rb
Constant Summary collapse
- GAPS =
LayoutOptions::GAPS
- DIRECTIONS =
%i[row col row_reverse col_reverse].freeze
- ALIGNMENTS =
%i[start center end stretch baseline].freeze
- JUSTIFICATIONS =
%i[start center end between around evenly].freeze
- WRAPS =
%i[nowrap wrap wrap_reverse].freeze
Constants inherited from Component
Component::ADDITIVE_DATA_ATTRIBUTES, Component::COMPONENT_OWNED_DATA_ATTRIBUTES, Component::FORBIDDEN_ATTRIBUTES, Component::RESERVED_DATA_ATTRIBUTES
Instance Method Summary collapse
-
#initialize(dir:, gap: 4, align: :start, justify: :start, wrap: :nowrap, id: nil, html: {}, aria: {}, data: {}, desperately_need_a_class: nil) ⇒ Flex
constructor
A new instance of Flex.
- #view_template ⇒ Object
Constructor Details
#initialize(dir:, gap: 4, align: :start, justify: :start, wrap: :nowrap, id: nil, html: {}, aria: {}, data: {}, desperately_need_a_class: nil) ⇒ Flex
Returns a new instance of Flex.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/components/nitro_kit/flex.rb', line 11 def initialize( dir:, gap: 4, align: :start, justify: :start, wrap: :nowrap, id: nil, html: {}, aria: {}, data: {}, desperately_need_a_class: nil ) dir = responsive_value(:dir, dir, DIRECTIONS) gap = responsive_value(:gap, gap, GAPS) align = responsive_value(:align, align, ALIGNMENTS) justify = responsive_value(:justify, justify, JUSTIFICATIONS) wrap = responsive_value(:wrap, wrap, WRAPS) super( component: :flex, attributes: { id:, data: { dir:, gap:, align:, justify:, wrap: } }.compact, html:, aria:, data:, desperately_need_a_class: ) end |
Instance Method Details
#view_template ⇒ Object
39 40 41 |
# File 'app/components/nitro_kit/flex.rb', line 39 def view_template div(**root_attributes) { yield if block_given? } end |