legos/events
Types
Values
pub fn key() -> decode.Decoder(String)
Decoder for getting the key name (event.key) This is the modern way to handle keyboard events
pub fn key_code() -> decode.Decoder(Int)
Decoder for getting the key code (event.keyCode) Note: This is deprecated in favor of event.key in modern browsers
pub fn on(
event_name: String,
decoder: decode.Decoder(msg),
) -> @internal Attribute(@internal Aligned, msg)
Create a custom event listener with a decoder This is equivalent to Html.Events.on in Elm
pub fn on_change(
msg: fn(String) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle change events with automatic value extraction
pub fn on_check(
msg: fn(Bool) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle checkbox change events with automatic checked state extraction
pub fn on_click(
msg: msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle click events
pub fn on_click_coords(
msg: fn(Coords) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle click events with local coordinates (relative to element)
pub fn on_click_page_coords(
msg: fn(Coords) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle click events with page coordinates
pub fn on_click_screen_coords(
msg: fn(Coords) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle click events with screen coordinates
pub fn on_double_click(
msg: msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle double click events
pub fn on_focus(
msg: msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle focus events (when element gains focus)
pub fn on_input(
msg: fn(String) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle input events with automatic value extraction
pub fn on_key_down(
msg: fn(String) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle key down events with automatic key extraction
pub fn on_key_press(
msg: fn(String) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle key press events with automatic key extraction
pub fn on_key_up(
msg: fn(String) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle key up events with automatic key extraction
pub fn on_lose_focus(
msg: msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle blur events (when element loses focus)
pub fn on_mouse_coords(
msg: fn(Coords) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle mouse move events with local coordinates (relative to element)
pub fn on_mouse_down(
msg: msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle mouse down events
pub fn on_mouse_enter(
msg: msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle mouse enter events
pub fn on_mouse_leave(
msg: msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle mouse leave events
pub fn on_mouse_move(
msg: msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle mouse move events
pub fn on_mouse_page_coords(
msg: fn(Coords) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle mouse move events with page coordinates
pub fn on_mouse_screen_coords(
msg: fn(Coords) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle mouse move events with screen coordinates
pub fn on_mouse_up(
msg: msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle mouse up events
pub fn on_submit(
msg: fn(List(#(String, String))) -> msg,
) -> @internal Attribute(@internal Aligned, msg)
Handle form submit events with automatic form data extraction
pub fn target_checked() -> decode.Decoder(Bool)
Decoder for getting the target checked state (event.target.checked) Useful for checkbox events
pub fn target_value() -> decode.Decoder(String)
Decoder for getting the target value (event.target.value) Useful for input events