Flux - Declarative, Utility-First Styling Framework for Roblox UI [Roact Support]

What is Flux?

A lightweight, minimal framework for styling Roblox UI using declarative Lua tables. Supports UI states, animations, layout utilities, components, and more. It is designed to be fast, easy to get along with, fully customizable, and flexible.

Github: Flux - Github
Guide: Guide - Flux
Releases: Download the .rbxl or the zip file here

Note: Although this is a stable release, it may have a few bugs. if you catch any, consider opening an issue.

Why Use Flux?

Flux helps you style Roblox UI faster and cleaner using declarative Lua tables. It removes repetitive property setting and adds support animations, inheritance, and more.

What’s New?

  • Flux now uses a declarative approach without regex patterns, this increases performance.

  • Component Presets: Define reusable style presets e.g. (primary-btn) and apply them anywhere with a single line.

code sample:

primary = {
            bg = "blue-500",
            textColor = "white",
            s = "md",
            textSize = "md",
            round = "md",
            align = "center",

            hover = {
                animate = {
                    bg = "red-500",
                    textSize = 50,
                    opacity = "75"
                },
            },
        },

to use it:

local initializer = require(game:GetService("ReplicatedStorage").flux.lib.initializer);
initializer.init();

initializer.applyStyles(element, "primary")
  • a Fully Customizable Experience: you can define your own classes with your own values in the config module and use them anywhere.

code sample:

-- config.luau
return {
	version = "1.0.0s",
	classes = {
		bg = {
			["red-350"] = Color3.fromRGB(250, 0, 0),
			["red-400"] = Color3.fromRGB(200, 0, 0),
			["red-450"] = Color3.fromRGB(150, 0, 0),
			["red-500"] = Color3.fromRGB(100, 0, 0),
		},
		textColor = {
			["red-350"] = Color3.fromRGB(250, 0, 0),
			["red-400"] = Color3.fromRGB(200, 0, 0),
			["red-450"] = Color3.fromRGB(150, 0, 0),
			["red-500"] = Color3.fromRGB(100, 0, 0),
		},
		animate = {
			["primary"] = {
				bg = "red-500",
				round = "md",
				s = "lg",
				duration = 0.5,
				easingStyle = Enum.EasingStyle.Linear,
				easingDirection = Enum.EasingDirection.InOut,
				repeatCount = 0,
				reverse = false,
				delayTime = 0,
			},
		}
	},
}

---------

Example Code

local initializer = require(game:GetService("ReplicatedStorage").flux.lib.initializer);
initializer.init();

local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui");

local element = Instance.new("TextButton", playerGui.Test);

initializer.applyStyles(element, {
 	s = "xl", -- size[both x, y]
 	bg = "white", -- background color
 	textColor = "black", -- text color
 	font = "arial", -- font 
 	align = "center", -- aligning
 	text = "Hello, Flux!", -- text
 	border = "md", -- border[UIStroke]
 	textSize = 32, -- font size
 	
 	hover = { -- hover state
        animate = { -- animate class
 			opacity = 0.5, -- animate opacity
 			bg = "black", -- animate background color
 			textColor = "white", -- aniamte text color
       }
     }
 });

Installation

You can install Flux using one of the following methods;

Method 1: Inserting Flux Directly into Your Place

  1. Download the latest .rbxl release from GitHub.
  2. Locate the .rbxl and open it

Method 2: Syncing via VS code

  1. Download the latest source code release from GitHub.
  2. Extract the Files into your project’s source directory.

Documentation

Full documentation for Flux can be found here. The API and examples will be updated as development progresses.

Contributing

Flux is an open-source project, and contributions are welcome! If you’d like to help improve the library by adding new features, fixing bugs, or improving documentation, check out the contribution guide.

Roadmap

  • Responsive design support
  • Themes/Theming and syncing across all UIs
  • Add support to more properties.

Survey:

by applying and voting in here, you are helping me to make flux a better library.

What do you think about Flux

  • Perfect
  • Good
  • Bad
  • Terrible
0 voters

How easy is it to learn Flux?

  • Hard
  • Intermediate
  • Easy
  • Very Easy
0 voters

Are you satisfied with the current features Flux offers?

  • Yes
  • Not Really
  • No
0 voters
16 Likes

pretty sure the normal ui scripting is much more simplier than… this.

5 Likes

i know that it’s syntax might seem a bit hard, but once you get to know it you’ll absolutely love it.

3 Likes

Thank you gpt

14 Likes

this reminds me of tailwind css actually

4 Likes

cool but can you use screenshots so I know how some components look like.

3 Likes

Yes, i used it to improve the context of the message, i believe that using such tools to help you do basic tasks quicker and easier is fine as long as you do not abuse it.

1 Like

yep, you’re totally right tailwindcss inspired me to make flux.

i love tailwind

2 Likes

Yes, some pics would be great, and even better would be a .rbxl with lots of working examples.

Thanks

2 Likes

Thank you, You’re Right, Adding pictures and examples would be alot better.

note: i Didn’t add Images and Pictures since this Version is just a Prototype, meaning allot of features is missing, being said, here is what the Example application i’ve wrote in the the devforum

 -- simple app example

local flux = require(game.ReplicatedStorage.flux.core.main)
local ScreenGui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)

local newElement = Instance.new("TextLabel", ScreenGui)
newElement.Text = "Hello, Flux!"

flux.applyStyles(newElement, "bg-gray-50 hover:bg-[30,30,30]-transition hover:text-[255,255,255]-transition sx-[30%] sy-[30%] align-center text-2xl font-arial font-bold round-md")

classes: bg-gray-50 is a predefined background color, hover:bg-[30,30,30]-transition is a dynamic class adding a gray-black background while also using the special keyword -transition to smoothness and transition to the hover state, hover:text-[255,255,255]-transition is a dynamic class applies a white text color and also using the special keyword -transition, sx-[30%] is a dynamic class that sets the X axis of the UI Size to 30% which is equivalent of 0.3, sy-[30%] is a dynamic class that sets the Y axis of the UI Size to 30% which is the equivalent of 0.3, align-center is a predefined class that sets the the UI to the center using a combination of Anchor Point and Position, text-2xl sets the text-font size to 24, font-arial using font arial, font-bold using the font bold weight, round-md sets the UI Corener of the UI to (0, 10).

outcome:
image
there is a hover effect with transition that turns text into white and background into black.

4 Likes

the new update is currently not out, however, im working on releasing it.

Ik thats it’s really hard, but it would be cool if it has its own coding language

Isnt this just roact?? Cool though if it is designed to be an alternative

2 Likes

Cool, but unpractical, just use Luau or TS or some sort. This is just utility classes, just like tailwind. From what I can tell, it already has quite a bit of logic going on

1 Like

no. flux is not a roact alternative, roact is a declarative framework that focuses on making guis and track their states. but flux is about styling guis with ease.

cool project :))

was actually thinking about making something similar to this recently for a react-like framework i’ve been working on. prefer using tailwind 10x more vs default styling.

would be cool to see flex/grid support for this type of thing

1 Like

thank you, Nov, for your feedback (:

Flexbox and Grid layouts are planned for the next update [v1.2.0-alpha].

2 Likes

I fail to understand the usage of this supposed framework.

From what I can see so far, it simply applies properties to an instance from a custom markup language, adding that it has one… or two animations to it somehow, having no way to make them ourselves.

I’m all in for a UI library that uses a custom markup language, given that it has the same functionality as popular libs such as React or VideUI. Otherwise, there’s no point using this.

well you’re right flux only supports a limited list of classes in the meantime, but there are some exciting features i planned on releasing to expand it’s capabilites. regarding the animations they were only included for testing purposes and will be removed in the next update. The next update will allow you to add your own classes, animations, and more.

The idea was good, but the execution…

horrible!

I’m on a search for something that can be applied to elements and style them without the painful process of coding it like Roact. This seemed promising at first until I read its syntax.

  1. Making it a string is a mistake, it’d be better if it was a table.
  2. I love the hover and stuff… but it’s uncomfortable without using TweenServices instances.
  3. It’s entirely different from the CSS language which falls out of the developers appeal unless it is stored as a Luau table.

I’d like to see an overhaul on this. Right now, Roblox StyleSheets haven’t come out in-game yet, so I’m just continuously searching.

1 Like