Skip to content

Components

Kimesh provides built-in components for routing and head management. All components are auto-imported.

Routing Components

<KmOutlet>

Renders matched child routes within a layout. Equivalent to Vue Router's <RouterView> but integrated with Kimesh's loader system.

vue
<template>
  <div class="layout">
    <Sidebar />
    <main>
      <KmOutlet />
    </main>
  </div>
</template>

Source: @kimesh/router-runtime


Type-safe navigation link component. Renders an <a> tag with SPA navigation behavior.

vue
<template>
  <!-- Basic -->
  <KmLink to="/about">About</KmLink>

  <!-- Named route with params -->
  <KmLink :to="{ name: 'posts-id', params: { id: '123' } }">
    Post 123
  </KmLink>

  <!-- External link (regular <a> tag) -->
  <KmLink to="https://example.com" external>External</KmLink>
</template>

Props

PropTypeDefaultDescription
tostring | RouteLocationRawRequiredTarget route
externalbooleanfalseOpen as external link
replacebooleanfalseUse router.replace instead of router.push
activeClassstring'router-link-active'Class when route is active
exactActiveClassstring'router-link-exact-active'Class when route is exactly active
prefetchbooleantruePrefetch target route data on hover

Type: KmLinkProps

Source: @kimesh/router-runtime


<KmDeferred>

Wraps Vue's <Suspense> with integrated error handling. Use with useSuspenseQuery for progressive data loading.

vue
<template>
  <KmDeferred :timeout="200">
    <!-- Default slot: async component -->
    <UserActivity :user-id="userId" />

    <!-- Fallback: loading state -->
    <template #fallback>
      <ActivitySkeleton />
    </template>

    <!-- Error: error state -->
    <template #error="{ error, retry }">
      <p>{{ error.message }}</p>
      <button @click="retry">Retry</button>
    </template>
  </KmDeferred>
</template>

Props

PropTypeDefaultDescription
timeoutnumber0Delay (ms) before showing fallback

Slots

SlotPropsDescription
defaultAsync component using await useSuspenseQuery()
fallbackLoading/skeleton UI
error{ error: Error, retry: () => void }Error state with retry

Source: @kimesh/router-runtime


Head Components

All head components are auto-imported from @kimesh/head. They manage <head> tags declaratively in your templates.

<KmHead>

Container for head elements:

vue
<template>
  <KmHead>
    <title>My Page</title>
    <meta name="description" content="..." />
  </KmHead>
</template>

<KmTitle>

Set the page title:

vue
<KmTitle>My Page Title</KmTitle>

<KmMeta>

Add a meta tag:

vue
<KmMeta name="description" content="Page description" />
<KmMeta property="og:title" content="My Page" />

Add a link tag to <head> (different from routing KmLink):

vue
<KmLink rel="canonical" href="https://example.com/page" />
<KmLink rel="stylesheet" href="/css/custom.css" />

Note: The head KmLink component is used inside <KmHead>. Outside of <KmHead>, KmLink refers to the routing link component.

<KmScript>

Add a script tag:

vue
<KmScript src="https://analytics.example.com/script.js" async />

<KmStyle>

Add an inline style block:

vue
<KmStyle>
  body { background: #f0f0f0; }
</KmStyle>

<KmHtml>

Set attributes on the <html> element:

vue
<KmHtml lang="en" dir="ltr" />

<KmBody>

Set attributes on the <body> element:

vue
<KmBody class="antialiased dark:bg-gray-900" />

Source: @kimesh/head

Released under the MIT License.