FusionRouter is a navigation library for Roblox UI built with Fusion.
It provides screens, modals, overlays, route params, lifecycle hooks, retention, and transitions.
FusionRouter is still in early development, but you can install it by cloning the repository and using it as a local package in your Roblox project.
local Fusion = require(path.to.fusion)
local Router = require(path.to.fusionRouter)
local router = Router.create({
screens = {
MainMenu = Router.screen(MainMenu),
Inventory = Router.screen(Inventory),
Shop = Router.screen(Shop),
},
modals = {
ItemDetails = Router.modal(ItemDetails),
},
}, Fusion)router:push("Inventory", {
category = "Weapons",
})
router:replace("Shop")
router:back()
router:reset("MainMenu")router:pushModal("ItemDetails", {
itemId = "sword_01",
})
router:popModal()
router:closeAllModals()Inside a route context:
ctx.close()Pass params when navigating:
router:push("Inventory", {
category = "Weapons",
})Read them inside a route:
local function Inventory(ctx)
print(ctx.params.category)
endScreen retention controls what happens when leaving a screen.
destroy— unmount the screen when it is leftkeepAlive— keep the screen mounted and preserve its statesingleton— reuse one persistent screen instance
Inventory = Router.screen(Inventory, {
retention = "keepAlive",
})Inventory = Router.screen(Inventory, {
onEnter = function(ctx)
print("entered inventory")
end,
onExit = function(ctx)
print("left inventory")
end,
onPause = function(ctx)
print("inventory hidden")
end,
onResume = function(ctx)
print("inventory resumed")
end,
})local router = Router.create({
transitions = {
screenPush = "slideLeft",
screenPop = "slideRight",
modalOpen = "fadeScaleIn",
modalClose = "fadeOut",
},
screens = {
MainMenu = Router.screen(MainMenu),
},
}, Fusion)retentionenterTransitionexitTransitioncanEntercanExitonEnteronExitonPauseonResumevalidateParams
transitionbarrierDismisscanEntercanExitonEnteronExitvalidateParams
persistentvisibleonEnteronExit
MIT License. See LICENSE for details.
