🚨 Disclaimer: Routify 3 is currently in Release Candidate stage.

Please be aware that while the documentation is comprehensive, it may contain inaccuracies or errors. The codebase is also subject to changes that could affect functionality. We appreciate your understanding and welcome any feedback or contributions.

guide

Advanced

Decorators

Decorators are Svelte components that wrap around each descending module and page.

Applying Decorators

Decorators can be applied in any of the following ways.

The router object
import { createRouter } from '@roxi/routify'
const router = createRouter({decorator: MyDecorator, ...})
The router component
<Router decorator={MyDecorator} ...>
The slot
<slot decorator={MyDecorator} ...>
The file structure
_decorator.svelte
_module.svelte
index.svelte

Decorator Inheritance

The examples above are shorthand for

decorator = (parentDecorators) => ([...parentDecorators, MyDecorator])

To avoid inheritance you can simply omit the parent decorators

decorator = () => ([MyDecorator])