Skip to content

Customizable kitbook navigation tree/menu #46

@kristianmandrup

Description

@kristianmandrup

Double-Check

Clear description of the requested feature

It feels a bit inconvenient that the current navigation tree is mapped directly to the underlying folder structure in the file system. Would be great if there was a way to configure a mapping to:

  • select specific components of interest
  • avoid deeply nested menu/tree structure
  • be more compatible with shadcn-ui in particular

For shadcn ui, a button component is by default installed in lib/components/ui/button/button.svelte
Would be very nice if this could be mapped to simply lib/shadcn/button in kitbook

Suggested solution

Setup some pattern matching rules that maps to a different structure, such as:

components/ui/**/*.svelte -> shadcn-ui/{name}

As kitbook traverses components, for each file path it could attempt a pattern match in each of the registered patterns and then apply a renaming rule

Alternative

I guess compositions could also alleviate this? Please advise.

Another approach would be to define a structure and for each define patterns (or functions?) for which components should be placed there. This could also allow sorting or relative re-positioning as desired.

{
  "shadcn-ui": ({components}) => {
     return components.filter(...).sort(...)
  } ,
  // ... more rules 

Additional context

I just discovered that there is a _meta.slot. It was unclear how to set the special slot property for the text of the button. I don't see any _meta reference documentation included?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions