Class: PhlexKit::ScrollArea

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/scroll_area/scroll_area.rb

Overview

Styled scroll container, ported from shadcn/ui's ScrollArea. Radix's custom scrollbars are replaced with native thin scrollbars themed via CSS — no JS. Constrain it with a height/width from the caller. tabindex=0 makes the scrollable region keyboard-focusable (WCAG); role=region gives that focus stop a role — pass aria: { label: ... } to name it. .pk-scroll-area (scroll_area.css).

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ ScrollArea

Returns a new instance of ScrollArea.



9
10
11
# File 'app/components/phlex_kit/scroll_area/scroll_area.rb', line 9

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#view_templateObject



13
14
15
# File 'app/components/phlex_kit/scroll_area/scroll_area.rb', line 13

def view_template(&)
  div(**mix({ class: "pk-scroll-area", tabindex: "0", role: "region" }, @attrs), &)
end