Module: Components::ListHelper

Defined in:
app/helpers/components/list_helper.rb

Instance Method Summary collapse

Instance Method Details

#list_item(value:, name:, selected: false, as: :div) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'app/helpers/components/list_helper.rb', line 2

def list_item(value:, name:, selected: false, as: :div)
   as, value,
    class: "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm
       outline-none aria-selected:bg-accent aria-selected:text-accent-foreground hover:bg-accent hover:text-accent-foreground
       data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
    role: "option",
    data: {value:, selected:},
    aria: {selected:}
end

#render_list(items, as: :div, **options) ⇒ Object



12
13
14
# File 'app/helpers/components/list_helper.rb', line 12

def render_list(items, as: :div, **options)
  render "components/ui/list", items:, as:, **options
end