Ce README explique comment creer un menu CyuUI en Lua (FiveM), avec tous les styles de boutons/items disponibles dans ce module.
AddButtonAddLinkButtonAddCheckboxAddListAddColorListAddSliderAddSeparatorAddLine
local MainMenu = CyuUI.CreateMenu(
"Mon Menu", -- title
"INTERACTIONS", -- subTitle
"Selectionnez une action", -- description
"", -- banner (url ou vide)
"F6", -- key (optionnel)
"Ouvrir le menu", -- mappingDescription (optionnel)
"#E53935" -- bannerColor (optionnel)
)
local SubMenu = CyuUI.CreateSubMenu(
MainMenu,
"Sous Menu",
"DETAILS",
"Options secondaires",
"",
"#1E88E5"
)MainMenu:OnOpen(function()
print("Menu ouvert")
end)
MainMenu:OnClose(function()
print("Menu ferme")
end)
MainMenu:SetClosable(true) -- false pour bloquer la fermeture via retourLe menu reconstruit ses items en temps reel. Utilisez SetItems pour declarer le contenu:
local checkboxState = false
local listIndex = 0
local colorIndex = 0
local sliderValue = 50
MainMenu:SetItems(function(Items)
Items:AddButton("Bouton simple", "Action classique", {
IsDisabled = false,
RightLabel = "~g~OK",
LeftBadge = "TICK_ICON",
RightBadge = "NEW_STAR",
Color = "#FFFFFF" -- actuellement non applique dans l'UI
}, function(onSelected, onHovered)
if onSelected then
print("Bouton selectionne")
end
end)
Items:AddButton("Aller au sous-menu", "Navigation", {
IsDisabled = false
}, function(onSelected)
if onSelected then
print("Ouverture sous-menu")
end
end, SubMenu)
Items:AddLinkButton("Documentation", "Ouvre un lien externe", {
IsDisabled = false,
LeftBadge = "HOST_CROWN",
Color = "#FFFFFF" -- actuellement non applique dans l'UI
}, "https://github.com/")
Items:AddCheckbox("Mode actif", "Etat On/Off", checkboxState, {
IsDisabled = false,
LeftBadge = "TICK_ICON",
Color = "#FFFFFF" -- actuellement non applique dans l'UI
}, function(onSelected)
if onSelected then
checkboxState = not checkboxState
end
end)
Items:AddList("Difficulte", "Choix de niveau", listIndex, {
"Facile", "Normal", "Difficile"
}, {
IsDisabled = false,
LeftBadge = "ARROWS_UPDOWN",
Color = "#FFFFFF" -- actuellement non applique dans l'UI
}, function(onSelected, onHovered, onListChange, index)
if onListChange then
listIndex = index
end
if onSelected then
print("Difficulte:", index)
end
end)
Items:AddColorList("Couleur UI", "Choix de couleur", colorIndex, {
"#E53935", "#FB8C00", "#FDD835", "#43A047", "#1E88E5"
}, {
IsDisabled = false,
LeftBadge = "ART_ICON_A",
Color = "#FFFFFF" -- actuellement non applique dans l'UI
}, function(onSelected, onHovered, onListChange, index)
if onListChange then
colorIndex = index
end
if onSelected then
print("Couleur index:", index)
end
end)
Items:AddSlider("Volume", "Reglage du son", sliderValue, 10, {
IsDisabled = false,
ShowPercentage = true,
Color = "#FFFFFF" -- actuellement non applique dans l'UI
}, function(onSelected, onHovered, onChange, percentage)
if onChange then
sliderValue = percentage
end
end)
Items:AddSeparator("SEPARATEUR", "center") -- left | center | right
Items:AddLine({ "#E53935", "#1E88E5", "#43A047" })
end)MainMenu:SetVisible(true) -- ouvrir
MainMenu:SetVisible(false) -- fermerMainMenu:Goto(SubMenu) -- aller vers cible
SubMenu:Goback() -- retour parentIsDisabled: booleanRightLabel: string|numberLeftBadge: BadgeNameRightBadge: BadgeNameColor: string(champ present mais non applique visuellement dans la version actuelle)
IsDisabled: booleanLeftBadge: BadgeNameColor: string(non applique visuellement actuellement)
IsDisabled: booleanLeftBadge: BadgeNameColor: string(non applique visuellement actuellement)
IsDisabled: booleanLeftBadge: BadgeNameColor: string(non applique visuellement actuellement)Indexattendu en base 0
IsDisabled: booleanShowPercentage: booleanColor: string(non applique visuellement actuellement)Percentage: 0 a 100Step: increment/decrement du slider
Position:"left"|"center"|"right"
Colors:string[](hex/rgb/rgba)
ARROW_LEFT, ARROW_RIGHT, HOST_CROWN, NEW_STAR, TICK_ICON, LOCK_ICON, ART_ICON_A, BARBER_ICON_A, GUNCLUB_ICON_A, etc.
La liste complete est definie dans items/_loadItems.lua (---@alias BadgeName).
AddList,AddColorListetAddSlidersont valides uniquement sur unmenu(pas surcontextMenu).- Le systeme met a jour les items en boucle (
UpdateItems), donc vos etats (checkboxState,listIndex, etc.) doivent etre stockes dans des variables persistantes. - Les champs
styles.Colorexistent cote Lua/props mais ne sont pas rendus dans les composants React actuels.
This README explains how to build a CyuUI menu in Lua (FiveM), including every button/item style currently available in this module.
AddButtonAddLinkButtonAddCheckboxAddListAddColorListAddSliderAddSeparatorAddLine
local MainMenu = CyuUI.CreateMenu(
"My Menu", -- title
"INTERACTIONS", -- subTitle
"Select an action", -- description
"", -- banner (url or empty)
"F6", -- key (optional)
"Open menu", -- mappingDescription (optional)
"#E53935" -- bannerColor (optional)
)
local SubMenu = CyuUI.CreateSubMenu(
MainMenu,
"Sub Menu",
"DETAILS",
"Secondary options",
"",
"#1E88E5"
)MainMenu:OnOpen(function()
print("Menu opened")
end)
MainMenu:OnClose(function()
print("Menu closed")
end)
MainMenu:SetClosable(true) -- false to prevent close on backThe menu rebuilds items in real time. Use SetItems to declare content:
local checkboxState = false
local listIndex = 0
local colorIndex = 0
local sliderValue = 50
MainMenu:SetItems(function(Items)
Items:AddButton("Simple button", "Classic action", {
IsDisabled = false,
RightLabel = "~g~OK",
LeftBadge = "TICK_ICON",
RightBadge = "NEW_STAR",
Color = "#FFFFFF" -- currently not rendered in UI
}, function(onSelected, onHovered)
if onSelected then
print("Button selected")
end
end)
Items:AddButton("Go to submenu", "Navigation", {
IsDisabled = false
}, function(onSelected)
if onSelected then
print("Opening submenu")
end
end, SubMenu)
Items:AddLinkButton("Documentation", "Open external link", {
IsDisabled = false,
LeftBadge = "HOST_CROWN",
Color = "#FFFFFF" -- currently not rendered in UI
}, "https://github.com/")
Items:AddCheckbox("Active mode", "On/Off state", checkboxState, {
IsDisabled = false,
LeftBadge = "TICK_ICON",
Color = "#FFFFFF" -- currently not rendered in UI
}, function(onSelected)
if onSelected then
checkboxState = not checkboxState
end
end)
Items:AddList("Difficulty", "Select level", listIndex, {
"Easy", "Normal", "Hard"
}, {
IsDisabled = false,
LeftBadge = "ARROWS_UPDOWN",
Color = "#FFFFFF" -- currently not rendered in UI
}, function(onSelected, onHovered, onListChange, index)
if onListChange then
listIndex = index
end
if onSelected then
print("Difficulty:", index)
end
end)
Items:AddColorList("UI Color", "Pick a color", colorIndex, {
"#E53935", "#FB8C00", "#FDD835", "#43A047", "#1E88E5"
}, {
IsDisabled = false,
LeftBadge = "ART_ICON_A",
Color = "#FFFFFF" -- currently not rendered in UI
}, function(onSelected, onHovered, onListChange, index)
if onListChange then
colorIndex = index
end
if onSelected then
print("Color index:", index)
end
end)
Items:AddSlider("Volume", "Audio setting", sliderValue, 10, {
IsDisabled = false,
ShowPercentage = true,
Color = "#FFFFFF" -- currently not rendered in UI
}, function(onSelected, onHovered, onChange, percentage)
if onChange then
sliderValue = percentage
end
end)
Items:AddSeparator("SEPARATOR", "center") -- left | center | right
Items:AddLine({ "#E53935", "#1E88E5", "#43A047" })
end)MainMenu:SetVisible(true) -- open
MainMenu:SetVisible(false) -- closeMainMenu:Goto(SubMenu) -- go to target
SubMenu:Goback() -- return to parentIsDisabled: booleanRightLabel: string|numberLeftBadge: BadgeNameRightBadge: BadgeNameColor: string(field exists but is not visually rendered in current UI)
IsDisabled: booleanLeftBadge: BadgeNameColor: string(currently not visually rendered)
IsDisabled: booleanLeftBadge: BadgeNameColor: string(currently not visually rendered)
IsDisabled: booleanLeftBadge: BadgeNameColor: string(currently not visually rendered)Indexis expected to be 0-based
IsDisabled: booleanShowPercentage: booleanColor: string(currently not visually rendered)Percentage: 0 to 100Step: slider increment/decrement
Position:"left"|"center"|"right"
Colors:string[](hex/rgb/rgba)
ARROW_LEFT, ARROW_RIGHT, HOST_CROWN, NEW_STAR, TICK_ICON, LOCK_ICON, ART_ICON_A, BARBER_ICON_A, GUNCLUB_ICON_A, etc.
Full list is defined in items/_loadItems.lua (---@alias BadgeName).
AddList,AddColorList, andAddSlideronly work onmenu(notcontextMenu).- Items are refreshed continuously (
UpdateItems), so your state (checkboxState,listIndex, etc.) must live in persistent variables. styles.Coloris exposed in Lua/props but is not rendered by the current React item components.