WindUI Roblox UI Library

repository·main·Indexed 43 days ago

https://github.com/footagesus/windui

A high-level UI library for Roblox scripts (v1.6.66) featuring a comprehensive set of interactive components including Toggles, Sliders, Dropdowns, and Colorpickers. It includes built-in support for localization, theme management, a ConfigManager for data persistence, and integrated key system authentication for services like Platoboost, PandaDevelopment, and Luarmor.

Tokens
4.4K
Snippets
13
Records
14
Agent score
7%

What's inside WindUI

  1. Organize UI with Sections and Tabs

    main

    WindUI uses a hierarchical structure to organize elements:

    1. Window: The root container.
    2. Sections: Groups of elements within a Tab or Window.
    3. Tabs: High-level navigation pages.

    Hierarchy Flow: Window -> Section -> Tab (Note: In this API, Tabs can be children of Sections, or Sections can be children of Tabs).

    Key Methods:

    • Window:Section({ Title = string, Opened = boolean?, ... }): Creates a new section.
    • Section:Tab({ Title = string, Icon = string?, Desc = string?, Locked = boolean? }): Creates a tab within a section.
    • Window:Tab({ Title = string, Icon = string?, Locked = boolean? }): Creates a top-level tab.
    • Section:Section({ ... }): Creates a nested section within a section.
    • Tab:Section({ ... }): Creates a section within a tab.
    local Sections = {
        Main = Window:Section({ Title = "Main Features", Opened = true }),
        Settings = Window:Section({ Title = "Settings", Opened = true })
    }
    
    local Tabs = {
        Elements = Sections.Main:Tab({ Title = "UI Elements", Icon = "layout-grid" }),
        Appearance = Sections.Settings:Tab({ Title = "Appearance", Icon = "brush" }),
        LockedTab = Window:Tab({ Title = "Locked", Icon = "bird", Locked = true })
    }
  2. Configure the Key System

    main

    The KeySystem configuration allows you to implement authentication gates using various third-party services. This is passed within the CreateWindow options table.

    Supported Service Types

    • platoboost: Requires ServiceId and Secret.
    • pandadevelopment: Requires ServiceId.
    • luarmor: Requires ScriptId and Discord URL.

    Example Configuration

    KeySystem = {
        API = {
            {
                Type = "platoboost",
                ServiceId = 5541,
                Secret = "your-secret-here",
            },
            {
                Type = "luarmor",
                ScriptId = "your-script-id",
                Discord = "https://discord.gg/example",
            }
        }
    }
  3. Display a Popup in WindUI

    main

    Use the WindUI:Popup method to create a modal dialog. The method accepts a table containing:

    • Title: The text displayed at the top (supports rich text/HTML-like formatting).
    • Icon: A string representing an icon (e.g., Lucide icon name, rbxassetid, or a raw image link).
    • Content: The body text of the popup (supports localization prefixes).
    • Buttons: An array of button objects, each containing:
      • Title: The button text.
      • Icon: An icon for the button.
      • Variant: The visual style (e.g., "Primary").
      • Callback: A function to execute when the button is clicked.
    WindUI:Popup({
        Title = "WindUI Demo",
        Icon = "sparkles",
        Content = "loc:LIB_DESC",
        Buttons = {
            {
                Title = "Get Started",
                Icon = "arrow-right",
                Variant = "Primary",
                Callback = function() end
            }
        }
    })
  4. Configure global WindUI settings

    main

    You can adjust global visual properties of the WindUI library directly on the WindUI object.

    • WindUI.TransparencyValue: Sets the global transparency level for UI elements.
    • WindUI:SetTheme(themeName): Sets the active visual theme (e.g., "Dark").
    WindUI.TransparencyValue = 0.2
    WindUI:SetTheme("Dark")
  5. Register a Key System Service

    main

    You can extend WindUI by adding custom services to WindUI.Services. This is primarily used for implementing key systems. A service entry in WindUI.Services requires:

    • Name: The display name of the service.
    • Icon: An icon identifier.
    • Args: An array of argument names that will be passed to the New function.
    • New: A function that handles the logic for creating the service instance. It receives the arguments defined in Args.
    • Verify: A function used to validate a provided key. It should return true, "Success Message" or false, "Error Message".
    • Copy: A function to handle copying information (like a key link) to the clipboard.
    WindUI.Services.mysuperservicetogetkey = {
        Name = "My Super Service",
        Icon = "droplet",
        Args = { "ServiceId" },
        New = function(ServiceId)
            -- Logic to initialize service
            return {
                Verify = function(key)
                    if not key then
                        return false, "Key is invalid!"
                    end
                    return true, "Key is valid!"
                end,
                Copy = function()
                    return setclipboard("link to key system service.")
                end
            }
        end
    }
  6. Send notifications with `Notify`

    main

    Use WindUI:Notify to display transient notification popups to the user.

    Parameters

    • Title: The heading of the notification.
    • Content: The body text of the notification.
    • Duration: How long (in seconds) the notification remains visible.
    WindUI:Notify({
        Title = "User Profile",
        Content = "User profile clicked!",
        Duration = 3
    })
  7. Use the ConfigManager for saving/loading data

    main

    The Window.ConfigManager allows you to persist data to files.

    Workflow:

    1. Initialize: Call ConfigManager:Init(Window).
    2. Create/Access Config: Use ConfigManager:CreateConfig(name) to get a config object.
    3. Set Data: Use configFile:Set(key, value) to store data.
    4. Save: Call configFile:Save() to write to disk.
    5. Load: Call configFile:Load() to retrieve data.
    6. Register Elements: You can register UI elements (like Toggles or Sliders) to a config so their state is automatically managed (though manual Set/Load is shown in the example).
    local ConfigManager = Window.ConfigManager
    if ConfigManager then
        ConfigManager:Init(Window)
        
        local myConfig = ConfigManager:CreateConfig("user_settings")
        
        -- Saving data
        myConfig:Set("player_level", 10)
        myConfig:Save()
        
        -- Loading data
        local data = myConfig:Load()
        if data then
            print("Loaded level:", data.player_level)
        end
    end
  8. Create Topbar Buttons

    main

    Use Window:CreateTopbarButton to add interactive elements to the window's top bar. This is useful for global actions like theme switching or opening specific menus.

    Arguments:

    • name (string): A unique identifier for the button.
    • icon (string): The icon name (e.g., using Lucide icon names).
    • callback (function): The function to execute when the button is clicked.
    • order (number, optional): The display order/priority of the button.
    Window:CreateTopbarButton("theme-switcher", "moon", function()
        WindUI:SetTheme(WindUI:GetCurrentTheme() == "Dark" and "Light" or "Dark")
    end, 990)
  9. Use interactive UI elements

    main

    WindUI provides several interactive components that can be added to Sections or Tabs. Most elements accept a Callback function that triggers when the value changes.

    Common Elements:

    • Toggle: { Title, Desc?, Flag?, Value, Callback }
    • Slider: { Title, Desc?, Flag?, Value = { Min, Max, Default }, Step?, Callback }
    • Dropdown: { Title, Values, Flag?, SearchBarEnabled?, Value, Callback }
    • Button: { Title, Icon?, Callback }
    • Input: { Title, Value, Callback }
    • Colorpicker: { Title, Default, Transparency?, Callback }
    • Code: { Title, Code, OnCopy? }
    • Paragraph: { Title, Desc, Image?, ImageSize?, Color?, Buttons? }
    • Divider: Creates a visual separator.
    -- Toggle Example
    local toggle = ElementsSection:Toggle({
        Title = "Enable Features",
        Flag = "featureToggle",
        Value = false,
        Callback = function(state)
            print("Toggle is now:", state)
        end
    })
    
    -- Slider Example
    local slider = ElementsSection:Slider({
        Title = "Intensity",
        Value = { Min = 0, Max = 100, Default = 50 },
        Callback = function(val) print(val) end
    })
    
    -- Dropdown Example
    local dropdown = ElementsSection:Dropdown({
        Title = "Options",
        Values = {"Option 1", "Option 2"},
        Callback = function(option) print(option) end
    })
  10. Manage Themes and Notifications

    main

    Themes

    Switch between available themes using WindUI:SetTheme(string). You can retrieve the current theme with WindUI:GetCurrentTheme() and list all available themes with WindUI:GetThemes().

    You can also listen for theme changes globally:

    WindUI:OnThemeChange(function(theme)
        print("Theme changed to:", theme)
    end)

    Notifications

    Display transient messages to the user using WindUI:Notify:

    WindUI:Notify({
        Title = "Success",
        Content = "Operation completed!",
        Icon = "check",
        Duration = 2
    })
    -- Switch theme
    WindUI:SetTheme("Light")
    
    -- Show notification
    WindUI:Notify({
        Title = "Theme Changed",
        Content = "Current theme: " .. WindUI:GetCurrentTheme(),
        Icon = "palette",
        Duration = 2
    })
  11. Handle Window Lifecycle Events

    main

    You can hook into various stages of the Window's lifecycle to perform cleanup or auto-save tasks:

    • Window:OnOpen(callback): Triggered when the window becomes visible.
    • Window:OnClose(callback): Triggered when the window is closed.
    • Window:OnDestroy(callback): Triggered when the window object is destroyed.
    Window:OnOpen(function()
        print("Window is now open!")
    end)
    
    Window:OnClose(function()
        print("Window was closed. Saving data...")
        -- Perform auto-save here
    end)
  12. Configure Window appearance and tags

    main

    You can customize the visual properties of the main Window object. This includes setting the icon size, background transparency, and adding decorative tags with custom colors or gradients.

    Key methods:

    • Window:SetIconSize(number): Sets the size of the window icon.
    • Window:SetBackgroundTransparency(number): Sets the background transparency.
    • Window:SetBackgroundImageTransparency(number): Sets the background image transparency.
    • Window:Tag({ Title = string, Color = Color3 | Gradient, Radius = number? }): Adds a tag to the window. Tags can use a solid Color3 or a WindUI:Gradient.
    Window:SetIconSize(48)
    
    -- Adding a solid color tag
    Window:Tag({
        Title = "v1.6.4",
        Color = Color3.fromHex("#30ff6a")
    })
    
    -- Adding a gradient tag
    local TimeTag = Window:Tag({
        Title = "--:--",
        Radius = 0,
        Color = WindUI:Gradient({
            ["0"]   = { Color = Color3.fromHex("#FF0F7B"), Transparency = 0 },
            ["100"] = { Color = Color3.fromHex("#F89B29"), Transparency = 0 },
        }, {
            Rotation = 45,
        }),
    })