LVRS Document Viewer
components/navigation/Link.svx
Path: components/navigation/Link.svx
Link
Location: qml/components/navigation/Link.qml
Link is a click-to-navigation control that wraps route/component navigation into a button-like API.
Purpose
- Provide declarative navigation trigger without direct router method calls in each click handler.
- Support route path navigation and component-target navigation in one component.
API
Routing:
router(optional explicit router)hrefto(alias ofhref)paramsreplacetargetComponent
Visual:
linkColorhoverColordisabledColorunderline
Content:
- default
contentslot - fallback text rendering when no slot child exists
Router Resolution
Link chooses router in this order:
- explicit
routerproperty Navigator.router- no-op if unresolved
Navigation Behavior
- if
targetComponentis set:replace == true->replaceWith(component, params)- else ->
goTo(component, params)
- else route path:
replace == true->replace(href, params)- else ->
go(href, params)
Usage
import LVRS 1.0 as LV
LV.Link {
href: "/reports"
text: "Open Reports"
underline: true
}
Advanced Example: Component Navigation Replacement
import QtQuick
import LVRS 1.0 as LV
Item {
Component { id: inspectorPage; Rectangle {} }
LV.Link {
targetComponent: inspectorPage
replace: true
params: ({ source: "sidebar" })
text: "Open Inspector"
}
}
Common Mistake
When no explicit router is provided, navigation silently no-ops if Navigator.router is not registered.
Ensure router registration exists in nested/embedded navigation setups.
Recipe: Route Replace for Wizard Step
import LVRS 1.0 as LV
LV.Link {
href: "/wizard/step-2"
replace: true
text: "Next"
}
Use replace to prevent back-stack noise in linear wizard flows.