View Source LiveViewNative.SwiftUI.Component (live_view_native_swiftui v0.3.1)
Define reusable function components with NEEx templates.
Function components in LiveView Native
are identical in every
way to function components in Live View
.
Summary
Components
Generates a link to a given route.
Components
Generates a link to a given route.
Unlike LiveView's own link
component, only href
and navigate
are supported.
patch
cannot be expressed with NavigationLink
. Use push_patch
within handle_event
to patch the URL.
href
will generate a <Link>
view which will delegate
to the user's default web browser.
navigate
will generate a <NavigationLink>
view
which will be handled by the client as a navigation request back to the LiveView server.
Attributes
navigate
(:string
) - Navigates from a LiveView to a new LiveView. The browser page is kept, but a new LiveView process is mounted and its content on the page is reloaded. It is only possible to navigate between LiveViews declared under the same routerPhoenix.LiveView.Router.live_session/3
. Otherwise, a full browser redirect is used.href
(:any
) - Uses traditional browser navigation to the new location. This means the whole page is reloaded on the browser.Global attributes are accepted. Additional attributes added to the
<NavigationLink>
tag. Supports all globals plus:["type"]
.
Slots
inner_block
(required) - The content rendered inside of the<NavigationLink>
tag.
Examples
<.link href="/">Regular anchor link</.link>
<.link navigate={~p"/"} class="underline">home</.link>
<.link navigate={~p"/?sort=asc"} replace={false}>
Sort By Price
</.link>
<.link href={URI.parse("https://elixir-lang.org")}>hello</.link>