Skip to content

🎯 Route Props in WBC-Routes2 ​

One of the most powerful features of WBC-Routes2 is the ability to pass any kind of prop to the WBC component within a route. This includes strings, arrays, objects, Markdown, HTML, Vue components, even dynamically encrypted props.


βœ… Basic String as item Prop ​

You can pass raw Markdown or HTML directly as a prop to WBC.

js
{
  path: "/simple",
  name: "SimpleRoute",
  component: WBC,
  props: {
    item: "## πŸ§ͺ Hello from Markdown!"
  }
}

πŸ“„ Loading Markdown File ​

Pass a relative path to a .md file (available in public or build root):

js
{
  path: "/doc",
  name: "DocPage",
  component: WBC,
  props: {
    item: "./md/docs/guide.md"
  }
}

πŸ“š Array of Props ​

If you want to render multiple components or Markdown sections, you can use an array of props:

js
{
  path: "/array-content",
  name: "ArrayRoute",
  component: WBC,
  props: {
    item: [
      "MD__## Section A",
      "<div class='info'>Some HTML</div>",
      "./md/docs/chapter1.md"
    ]
  }
}

🧩 Full WBC Object as Prop ​

You can pass an object to fully configure the WBC rendering behavior:

js
{
  path: "/object",
  name: "ObjectRoute",
  component: WBC,
  props: {
    item: {
      comp: "MD",
      options: {
        class: "pa-4 teal lighten-5",
        html: "# 🧠 Dynamic from Object"
      }
    }
  }
}

🌍 Multilingual Props ​

WBC-Routes2 supports multilingual content out-of-the-box. Just provide an object keyed by language codes:

js
{
  path: "/multilang",
  name: "MultilangRoute",
  component: WBC,
  props: {
    item: {
      en: "## Hello",
      fr: "## Bonjour",
      ar: "## Ω…Ψ±Ψ­Ψ¨Ψ§"
    }
  }
}

If your app uses i18n, the right language version will be picked automatically.


🧠 Combining Mixed Content ​

You can mix file paths, inline Markdown, WBC objects, and Vue components:

js
{
  path: "/mixed",
  name: "MixedProps",
  component: WBC,
  props: {
    item: [
      "<~VContainer|pa-5 grey>",
      {
        comp: "VCard",
        options: {
          class: "pa-3",
          html: "πŸš€ Mixed content inside a card"
        }
      },
      "MD__### Inline Markdown",
      "./md/docs/summary.md"
    ]
  }
}

πŸ›‘οΈ Prop Validation (Optional) ​

Although Vue Router itself doesn’t enforce prop types, you can add basic validation via Vue's props config inside the WBC component or wrapper layout.


πŸ” Summary ​

TypeSupportedNotes
Raw Textβœ…Markdown or HTML
Markdown Fileβœ…Relative path
Object with comp/optionsβœ…Full dynamic rendering
Multilingual Objectβœ…i18n-aware
Array of Mixed Contentβœ…Combine any format
JSON or Config Blocksβœ…Advanced, requires correct structure