← Back

SelectList

[intermediate]

Dropdown select list with keyboard navigation

SelectList Demo

Dropdown select list with keyboard navigation

For the full interactive experience:

$ mix raxol.playground

Code
dropdown_items =
  if model.open do
    model.options
    |> Enum.with_index()
    |> Enum.map(fn {opt, i} ->
      prefix = DemoHelpers.cursor_prefix(i, model.selected)
      text("#{prefix}#{opt}")
    end)
  else
    []
  end
demo j/k prev/next / focus demo esc back 9/42 demos