Tuix.Event.Key (tuix v0.1.4)

Copy Markdown View Source

A keyboard event.

key is either a single printable grapheme ("a", "+", "é") or a named key atom:

:enter, :tab, :backtab, :backspace, :escape, :up, :down, :left, :right, :home, :end, :insert, :delete, :page_up, :page_down, :space

target is the id of the focused element at the time of the event (nil when nothing is focused), stamped by the runtime so apps can pattern match on it:

def handle_event(%Key{key: :enter, target: :email}, app), do: ...

Summary

Types

t()

@type t() :: %Tuix.Event.Key{
  alt: boolean(),
  ctrl: boolean(),
  key: String.t() | atom(),
  shift: boolean(),
  target: term() | nil
}