Phoenix LiveView components with the LineOne design.
use LineaUIimports every component. Pick or drop some with :only and :except, which take the
keys of components/0:
use LineaUI, only: [:button, :modal]
use LineaUI, except: [:table]avoid_conflicts: true drops the names Phoenix's generated CoreComponents also defines
(button, input, table, label, error, header).
Overlays
A modal, drawer, popover, dropdown or tooltip is opened, closed and toggled by its id,
in three shapes:
| Call | Returns | Use in |
|---|---|---|
LineaUI.open("id") | %JS{} | phx-click |
LineaUI.open(socket, "id") | socket | handle_event/3, handle_info/2 |
LineaUI.open(%JS{}, "id") | %JS{} | a JS pipeline |
The same holds for close and toggle. "id" and "#id" are both accepted.
Summary
Functions
Closes the overlay with id.
The component modules use LineaUI imports, by key.
Opens the overlay with id.
Opens the overlay with id when it is closed and closes it when it is open.
Functions
@spec close(String.t()) :: Phoenix.LiveView.JS.t()
Closes the overlay with id.
@spec close(Phoenix.LiveView.Socket.t() | Phoenix.LiveView.JS.t(), String.t()) :: Phoenix.LiveView.Socket.t() | Phoenix.LiveView.JS.t()
The component modules use LineaUI imports, by key.
@spec open(String.t()) :: Phoenix.LiveView.JS.t()
Opens the overlay with id.
@spec open(Phoenix.LiveView.Socket.t() | Phoenix.LiveView.JS.t(), String.t()) :: Phoenix.LiveView.Socket.t() | Phoenix.LiveView.JS.t()
@spec toggle(String.t()) :: Phoenix.LiveView.JS.t()
Opens the overlay with id when it is closed and closes it when it is open.
@spec toggle(Phoenix.LiveView.Socket.t() | Phoenix.LiveView.JS.t(), String.t()) :: Phoenix.LiveView.Socket.t() | Phoenix.LiveView.JS.t()