Class: PhlexKit::ResizablePanelGroup
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::ResizablePanelGroup
- Defined in:
- app/components/phlex_kit/resizable/resizable_panel_group.rb
Overview
Resizable split panels, ported from shadcn/ui's Resizable. The
react-resizable-panels dependency is replaced by the phlex-kit--resizable
controller: dragging a ResizableHandle rebalances the flex-grow of its
neighbouring ResizablePanels. Compose ResizablePanelGroup(direction:) >
ResizablePanel + ResizableHandle + ResizablePanel…
.pk-resizable* (resizable.css).
Constant Summary collapse
- DIRECTIONS =
{ horizontal: "horizontal", vertical: "vertical" }.freeze
Instance Method Summary collapse
-
#initialize(direction: :horizontal, **attrs) ⇒ ResizablePanelGroup
constructor
A new instance of ResizablePanelGroup.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(direction: :horizontal, **attrs) ⇒ ResizablePanelGroup
Returns a new instance of ResizablePanelGroup.
11 12 13 14 |
# File 'app/components/phlex_kit/resizable/resizable_panel_group.rb', line 11 def initialize(direction: :horizontal, **attrs) @direction = DIRECTIONS.fetch(direction.to_sym) @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/components/phlex_kit/resizable/resizable_panel_group.rb', line 16 def view_template(&) div(**mix({ class: "pk-resizable-group #{@direction}", data: { controller: "phlex-kit--resizable", phlex_kit__resizable_direction_value: @direction } }, @attrs), &) end |