TopbarPlus
repository·main·Indexed 42 days ago
https://github.com/1foreverhd/topbarplusA Roblox library for creating and managing custom UI elements, buttons, and menus within the Roblox topbar. It features a chainable API for configuring icons via Icon.new(), support for dropdowns and horizontal menus, notification bubbles, and built-in gamepad and console support. Developers can bind GuiObjects or KeyCodes to icons and customize themes globally or per-icon.
What's inside TopbarPlus
- TopbarPlus is a library for Roblox developers that allows for the creation of custom, highly customizable buttons and elements in the Roblox topbar. It provides a way to manage UI elements that sit at the top of the screen, typically used for game menus, settings, or player actions, with a focus on ease of use and visual consistency.
Use icon states to change appearance based on selection or hover
mainMethods tagged with
toggleablein the API allow you to specify aniconStateto apply a value only during specific interaction states. If no state is provided, the value applies to all states.Supported states (case-insensitive):
"Deselected": Applies when the icon is not pressed."Selected": Applies when the icon is pressed."Viewing": Applies when a cursor hovers over, a controller highlights, or a mobile user long-presses the icon (before release).
-- Example: Changing labels based on state Icon.new() :setImage(4882429582) :setLabel("Closed", "Deselected") :setLabel("Open", "Selected") :setLabel("Viewing", "Viewing")Gamepad and Console Support
mainTopbarPlus includes built-in support for gamepads and consoles. Users can navigate the topbar via a virtual cursor or by pressing
DPadUpto highlight the last-selected icon (or the leftmost icon if none are selected).To change the default trigger keycode from
DPadUp, use:Icon.highlightKey = Enum.KeyCode.NEW_KEYCODECreate Dropdowns, Menus, and Fixed Menus
mainOrganize multiple icons into navigation structures:
Dropdowns
Vertical navigation frames containing an array of icons. Note: Icons containing a dropdown can join other menus, but they cannot be placed inside other dropdowns.
Icon.new() :setLabel("Example") :setDropdown({ Icon.new():setLabel("Category 1"), Icon.new():setLabel("Category 2") })Menus
Horizontal navigation frames containing an array of icons.
Icon.new() :setLabel("Example") :setMenu({ Icon.new():setLabel("Item 1"), Icon.new():setLabel("Item 2") })Fixed Menus
Similar to normal menus, but they are forcefully opened (selected) by default, and the close button is hidden.
Icon.new() :setFixedMenu({ Icon.new():setLabel("Item 1"), Icon.new():setLabel("Item 2") })-- Dropdown Example Icon.new() :setLabel("Example") :modifyTheme({"Dropdown", "MaxIcons", 3}) :modifyChildTheme({"Widget", "MinimumWidth", 158}) :setDropdown({ Icon.new():setLabel("Category 1"), Icon.new():setLabel("Category 2") })Using multiple TopbarPlus packages in a single experience
mainTopbarPlus is designed to support multiple Icon packages within a single Roblox experience without conflicts, provided all packages are version
v3.0.0or above.When a new TopbarPlus package is required, it automatically checks if a TopbarPlus instance has already been initialized in the experience. If an instance is found, the new package cancels its own loading process and refers to the existing, already-initialized package. This mechanism ensures that third-party libraries or plugins using TopbarPlus do not interfere with your own implementation.
Handle icon overflows
mainTo prevent icons from overlapping on smaller screens or mobile devices in portrait mode, TopbarPlus uses an overflow system.
- Left-set or right-set icons will trigger an overflow if they exceed the boundary of the closest opposite-aligned icon or the viewport.
- If a center-aligned icon exceeds the bounds of another icon, its alignment will automatically switch to match the alignment of the icon it exceeded.
Install TopbarPlus with Rojo
mainTo use TopbarPlus in a Rojo-based workflow:
- Fork the TopbarPlus repository.
- Clone your fork into your local project repository.
- Modify the
serve.project.jsonfile to set your desired location (the default isWorkspace). - Run
rojo servevia your terminal or VS Code plugin and connect using the Rojo Studio plugin.
rojo serveInstall and create a basic icon with TopbarPlus
mainTo use TopbarPlus, require the
Iconmodule fromReplicatedStoragewithin aLocalScript(typically placed inStarterPlayerScripts). CallingIcon.new()constructs an empty 32x32 icon on the topbar.By default, icons are ordered based on their construction sequence using the formula
1+(totalCreatedIcons*0.01). Icons created earlier have a lower order and appear further to the left.-- Within a LocalScript in StarterPlayerScripts local Icon = require(game:GetService("ReplicatedStorage").Icon) local icon = Icon.new()Install TopbarPlus via Manual Download
mainIf you prefer not to use the Roblox Model system, you can download the model file directly:
- Visit the latest release on GitHub.
- Under the Assets section, download
TopbarPlus.rbxm. - In Roblox Studio, go to MODEL -> Model and insert the downloaded file anywhere within
ReplicatedStorage.
Configure icon appearance using method chaining
mainYou can customize an icon's appearance by using
setImage(imageId)andsetLabel("Label"). These methods are chainable, allowing you to configure the icon in a single statement.To perform logic on an icon during the construction chain, use the
:call(function(icon) ... end)method. This passes the icon instance as the first argument to your function.-- Using method chaining Icon.new() :setImage(imageId) :setLabel("Label") -- Using :call to act on the icon during construction Icon.new() :setName("TestIcon") :call(function(icon) print(icon.name) -- Prints 'TestIcon' end)Install TopbarPlus with Wally
mainTopbarPlus is available as a Wally package. You can install it using the following package identifier:
1foreverhd/topbarplusFind the package details at wally.run/package/1foreverhd/topbarplus.
wally install 1foreverhd/topbarplusInstall TopbarPlus via the Roblox Model
mainThe recommended installation method is to use the official Roblox model.
- Take the TopbarPlus model.
- In Roblox Studio, open the Toolbox and navigate to Inventory -> My Models.
- Insert the model into your game and place it anywhere within
ReplicatedStorageorWorkspace.
Updating the model: Since TopbarPlus is a package, you can update it without re-adding it. Right-click the
Iconmodule and select an option like 'Get Latest Package'. You can also enable 'AutoUpdate' within thePackageLinkto receive automatic updates.Important Notes:
- Do not modify code inside the
Iconpackage, as this will break the package link. - Roblox Package Support: As of June 7th, 2025, if Roblox public packages have not been fully rolled out in your environment, attempting to use 'Get Latest Package' will throw an error.
# No code snippet provided for manual model insertion, but the process is via Roblox Studio UI.