← Back to list

router
by InKCre
Design system and any other design stuff of InKCre
⭐ 0🍴 0📅 Jan 16, 2026
SKILL.md
name: router description: Integrate @inkcre/web-design with Vue Router using the adapter pattern.
Router Integration
Use this skill when integrating @inkcre/web-design components with Vue Router.
Overview
Some components (like InkHeader) need router capabilities. The design system uses a provider pattern that works with any router implementation.
Interface
import type { ComputedRef, InjectionKey } from "vue";
export interface InkRouter {
/** Current path (reactive) */
currentPath: ComputedRef<string>;
/** Current page name */
currentName: ComputedRef<string | null>;
}
export const INK_ROUTER_KEY: InjectionKey<InkRouter> = Symbol("INK_ROUTER");
Setup
- Create a router adapter:
// router-adapter.ts
import { computed } from "vue";
import type { Router, RouteLocationNormalizedLoaded } from "vue-router";
import type { InkRouter } from "@inkcre/web-design";
export function createInkRouterAdapter(
router: Router,
route: RouteLocationNormalizedLoaded
): InkRouter {
return {
currentPath: computed(() => route.path),
currentName: computed(() => route.name),
};
}
- Provide in your app:
// App.vue
<script setup lang="ts">
import { INK_ROUTER_KEY } from "@inkcre/web-design";
import { createInkRouterAdapter } from "./router-adapter";
import { useRoute, useRouter } from "vue-router";
provide(
INK_ROUTER_KEY,
createInkRouterAdapter(useRouter(), useRoute())
);
</script>
Usage in Components
import { useOptionalRouter } from "@inkcre/web-design";
const router = useOptionalRouter();
if (router) {
console.log(router.currentPath.value);
}
Score
Total Score
55/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon


