# `PhoenixKitWeb.Components.Core.PkLink`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/phoenix_kit_web/components/core/pk_link.ex#L1)

Provides prefix-aware link components for PhoenixKit navigation.

These components automatically apply the configured PhoenixKit URL prefix
to paths, ensuring links work correctly regardless of the prefix configuration.

## Why Use These Components?

PhoenixKit supports a configurable URL prefix (default: `/phoenix_kit`).
Using these components instead of hardcoded paths ensures your links
work correctly when the prefix changes.

## Examples

    # Instead of hardcoding:
    <.link navigate="/phoenix_kit/dashboard">Dashboard</.link>

    # Use pk_link for automatic prefix handling:
    <.pk_link navigate="/dashboard">Dashboard</.pk_link>

    # Works with all link types:
    <.pk_link navigate="/admin/users">Users</.pk_link>
    <.pk_link patch="/dashboard?tab=settings">Settings</.pk_link>
    <.pk_link href="/api/export">Export</.pk_link>

## Configuration

The URL prefix is configured in your application:

    config :phoenix_kit, url_prefix: "/my_prefix"

# `pk_link`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/phoenix_kit_web/components/core/pk_link.ex#L77)

Renders a link with automatic PhoenixKit URL prefix handling.

This component wraps Phoenix's `<.link>` and automatically prepends
the configured PhoenixKit URL prefix to the path.

## Attributes

  * `navigate` - The path for LiveView navigation (full page load within LiveView)
  * `patch` - The path for LiveView patch (updates URL without full navigation)
  * `href` - The path for standard HTTP navigation
  * `class` - CSS classes to apply
  * `replace` - When true, replaces browser history instead of pushing

Only one of `navigate`, `patch`, or `href` should be provided.

## Examples

    <.pk_link navigate="/dashboard">Dashboard</.pk_link>

    <.pk_link navigate="/admin/users" class="btn btn-primary">
      Manage Users
    </.pk_link>

    <.pk_link patch="/settings" replace={true}>
      Settings
    </.pk_link>

## Attributes

* `navigate` (`:string`) - Path for LiveView navigate. Defaults to `nil`.
* `patch` (`:string`) - Path for LiveView patch. Defaults to `nil`.
* `href` (`:string`) - Path for standard href. Defaults to `nil`.
* `class` (`:string`) - Defaults to `nil`.
* `replace` (`:boolean`) - Defaults to `false`.
* Global attributes are accepted. Supports all globals plus: `["download", "hreflang", "referrerpolicy", "rel", "target", "type"]`.
## Slots

* `inner_block` (required)

# `pk_link_button`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/phoenix_kit_web/components/core/pk_link.ex#L118)

Renders a button-styled link with automatic PhoenixKit URL prefix handling.

Convenience component that combines `pk_link` with button styling.

## Examples

    <.pk_link_button navigate="/dashboard">Dashboard</.pk_link_button>

    <.pk_link_button navigate="/admin/users" variant="secondary">
      Manage Users
    </.pk_link_button>

## Attributes

* `navigate` (`:string`) - Defaults to `nil`.
* `patch` (`:string`) - Defaults to `nil`.
* `href` (`:string`) - Defaults to `nil`.
* `class` (`:string`) - Defaults to `nil`.
* `variant` (`:string`) - Defaults to `"primary"`. Must be one of `"primary"`, `"secondary"`, `"ghost"`, `"link"`, or `"outline"`.
* `replace` (`:boolean`) - Defaults to `false`.
* Global attributes are accepted.
## Slots

* `inner_block` (required)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
