[FREE] Vein: an easy-to-use GUI library for FiveM

Vein is an immediate mode GUI library for FiveM.
The main goal was to create a newbie-friendly and fun-to-use GUI library without Web technologies.
Vein uses GTA V graphics API for input handling and rendering.
It is written on TypeScript, but you can use it with your favourite programming language, thanks to FiveM exports mechanism.
Vein provides a decent built-in item library, which you can customize with a CSS subset or even extend with your own ones.

Video Showcase

Quick Start

  • Download and put into resources/ directory
  • Add ensure vein to server.cfg

Immediate mode

local vein = exports.vein
vein:beginFrame()
if vein:button('Click Me') then
  print('Hello World!')
end
vein:endFrame()

Documentation

Visit Vein website for documentation.

Demo

Follow Vein demo as an example for your own GUI.
Run it as FiveM server resource to see how Vein looks like in game (use /veinDemo command).

36 Likes

the Image and the Video dont appear to be showing the same thing… Can we get a better showcase? not entirely certain what this does

5 Likes

Why they should show the same things?
Screenshot is for demonstrating widgets library and video is for window example.

Uuu, I’ve been waiting for this. Gonna try something with it soon-ish

2 Likes

Nice replacement for NativeUi/RageUI or even your old warmenu.

Look forward to testing this out.

1 Like

ahh i see so the weather UI is an example of what you create with the script… got it

Wow! Amazing work!

1 Like

Amazing!

2 Likes

Good job just Amazing

1 Like

This is beautiful.


Thank you for your amazing work, as an example of what people could do as below.

It seems to keep active even after breaking or returning the loop, that Early Access, AmIRight?

Simple Pin Code

local labelWidth = 0.09

local vein = exports.vein

local function drawLabel(text)
	vein:pushWidgetWidth(labelWidth)
	vein:label(text)
	vein:popWidgetWidth()
end

local function EnterPin()
	local text = {}
	local textReturn = ""
	while true do
		Citizen.Wait(0)

		vein:beginWindow()

		vein:heading('Enter Code')

		vein:spacing()

		vein:beginRow()
			_, textReturn = vein:textEdit(table.concat(text), 'Enter Pin...', 100, true)
		vein:endRow()

		vein:spacing()

		vein:beginRow()
			if vein:button(' 1') then
				table.insert(text, "1")
			end
			vein:spacing()
			if vein:button('2') then
				table.insert(text, "2")
			end
			vein:spacing()
			if vein:button('3') then
				table.insert(text, "3")
			end
		vein:endRow()

		vein:spacing()

		vein:beginRow()
			if vein:button('4') then
				table.insert(text, "4")
			end
			vein:spacing()
			if vein:button('5') then
				table.insert(text, "5")
			end
			vein:spacing()
			if vein:button('6') then
				table.insert(text, "6")
			end
		vein:endRow()

		vein:spacing()

		vein:beginRow()
			if vein:button('7') then
				table.insert(text, "7")
			end
			vein:spacing()
			if vein:button('8') then
				table.insert(text, "8")
			end
			vein:spacing()
			if vein:button('9') then
				table.insert(text, "9")
			end
		vein:endRow()

		vein:spacing()

		if vein:button('Enter') then
			return textReturn
		end
		if vein:button('Close') then
			return nil
		end

		vein:endWindow()
	end
end


RegisterCommand('veinpin', function()
	Citizen.CreateThread(function()
		while true do
			Citizen.Wait(0)
			local returnedpin = EnterPin()
			if returnedpin ~= nil then
				print(returnedpin)
				break
			end
		end
	end)
end)
3 Likes

Remove while-true loop from RegisterCommand handler.

Really enjoying this framework, but I do have some questions / possible bugs or limitations.

  1. this there / will there be a way to add long text on the menu, like paragraphs? Currently, from my testing I only managed to add 99 character length labels at max. Having a proper text box could also help with automatic text breaking (pic related of current behavior).

  2. Header text font, has symbols for some characters (blank box for #, filled box for /, and bold : is what I found). If it’s a GTA original font, we might need to stream a different one.

1 Like

Odd, even from your original demo.lua.

It still stayed or looked like it was running when completed… I’ll try and grab a screen when Im backon my pc and add an issue to github if so.

Insane! Great job

1 Like

Thanks for feedback!

  1. That’s because text parameter is based on STRING text entry, which is limited to 99 characters.
    You should use AddTextEntry and text entry API to display more characters.
    Multiline text will be added later.

  2. Heading font was updated.

2 Likes

This is for me THE release of 2021! Any idea of the date for the official release?

2 Likes

No, but I think it’s ready to use for 99% cases.
I expect people using it and sharing feedback, so I could improve API and fix bugs.

1 Like

Is there a Documentation? I would like to make a script using it like today :slight_smile:

All links are in first post.

Great release with nice documentation! And it’s FREE! I’m going to start converting a couple interfaces tonight

1 Like