Class: NitroKit::ButtonGroup

Inherits:
Component
  • Object
show all
Defined in:
app/components/nitro_kit/button_group.rb

Instance Attribute Summary

Attributes inherited from Component

#attrs

Instance Method Summary collapse

Methods inherited from Component

#data_merge, #initialize, #merge, merge

Constructor Details

This class inherits a constructor from NitroKit::Component

Instance Method Details

#view_template(&block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/components/nitro_kit/button_group.rb', line 3

def view_template(&block)
  div(
    class: merge(
      [
        "flex -space-x-px isolate",
        # Remove rounded corners from middle buttons
        "[&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:first-child:not(:last-child)]:rounded-r-none [&>*:last-child:not(:first-child)]:rounded-l-none",
        # Put focused button on top
        "[&>*]:focus:z-10",
        attrs[:class]
      ]
    ),
    &block
  )
end