View Source PhxLiveStorybook.Router (phx_live_storybook v0.3.0)
Provides LiveView routing for storybook.
Link to this section Summary
Functions
Defines a PhxLiveStorybook route.
Link to this section Functions
Defines a PhxLiveStorybook route.
It expects the path
the storybook will be mounted at and a set
of options.
This will also generate a named helper called live_dashboard_path/2
which you can use to link directly to the dashboard, such as:
<%= link "Storybook", to: live_storybook_path(conn, :root) %>
Note you should only use link/2
to link to the storybook (and not
live_redirect/live_link
, as it has to set its own session on first
render.
options
Options
:otp_app
- Required - OTP Name of your Phoenix application. It must match:otp_app
of your backend module and settings.:backend_module
- Required - Name of your backend module.:live_socket_path
- Configures the socket path. It must match thesocket "/live", Phoenix.LiveView.Socket
in your endpoint.
usage
Usage
# lib/my_app_web/router.ex
use MyAppWeb, :router
import PhxLiveStorybook.Router
...
scope "/" do
pipe_through :browser
live_storybook "/storybook",
otp_app: :my_app,
backend_module: MyAppWeb.Storybook
end