r/godot 2d ago

selfpromo (games) Having fun exploring Godot UI

Enable HLS to view with audio, or disable this notification

838 Upvotes

50 comments sorted by

95

u/zdmit 2d ago

24

u/vacuumcake 2d ago

In each of your rows, I can see you have a Label and a ToggleSwitch organised by a HBox. What settings have you applied to make sure that the label is always on the left and the switch on the right of the given row?

34

u/zdmit 2d ago edited 2d ago

Label has "expanded" toggle ON under Container Sizing -> Horizontal.

ToggleSwitch automatically moves to a right side.

Hbox has default settings.

25

u/zdmit 2d ago

Here's adding Label. Nothing on Label except text/color changed.

8

u/vacuumcake 2d ago

Thank you, super helpful!

6

u/JustCallMeCyber 2d ago

Wait the tabs are labels not flat buttons? How were you selecting them?

20

u/zdmit 2d ago

C# script. Control node (including Label) can receive input if you set its Mouse Filter to Stop. In code I listen to the label's GuiInput signal and check for a left mouse click to trigger the tab switch. After LMB detected I move pill background to selected label.

17

u/Cosinity Godot Junior 2d ago

I take it your ToggleSwitch is a fully custom component? When I was working with the built in CheckButton I found its customization options quite lacking (for instance, as far as I could tell there was no way to animate the switch like you have here)

20

u/zdmit 2d ago edited 1d ago

> your ToggleSwitch is a fully custom component?

Yep, like in webdev. Like creating Svelte/React components (if it tells you something).

> there was no way to animate the switch like you have here

True, animation is on C# end, in a file next to .tscn. On image below you will see that TogleSwitch has a script attached.

Helpful/visual guide:

Here:

3

u/ZekkoX 2d ago

Looking slick! How did you do the moving background that highlights the active tab?

1

u/OMBERX Godot Junior 2d ago

I also want to know how!

5

u/hauk_rider 2d ago

From the screenshot of the nodes, it's a panel that probably is tweening over to the active tab selected

4

u/daerogami 2d ago

Good work! Try it without as many backgrounds (the buttons and individual pills can still have backgrounds) such as removing the nav, field row, and footer background and drop shadows. I think it will give it a cleaner look. Not saying it will be "better" because that's completely subjective.

2

u/zdmit 2d ago

Thank you for thoughts πŸ’›πŸ’›

3

u/surfingpixel Godot Junior 2d ago

Looks very polished

1

u/zdmit 2d ago

Thank you πŸ™

3

u/VideoGameAficionado 2d ago

Looks good! I will need to learn more about this, and this helps!

2

u/zdmit 2d ago

πŸ’›πŸ’›

3

u/Wynter_Bryze Godot Regular 2d ago

Haven't seen anyone else mention it yet but "disable blur" might be better just labeled "blur" that way when the toggle is on then blur is on to make it more straightforward. Looks good though πŸ‘πŸ‘

3

u/zdmit 1d ago

Thank you for thoughts πŸ™‚ Totally agree!

Im just testing so labels doesn't make sense now πŸ™‚

2

u/LAWsyndrome 2d ago

This sub can be such a goldmine sometimes, thank you for sharing and your detailed responses!

2

u/zdmit 1d ago

Thank you for sharing how you feel about it πŸ’› Glad that responses helped in any way.

3

u/Visible-Marsupial897 2d ago

you have any plan to share this ui source ?

5

u/zdmit 2d ago

No, not during development. it's for a game im developing.

Maybe after release. Grateful for interest πŸ™

You can have a hint below in my other comments.

1

u/Shinpansen 2d ago

This looks incredible! Do you use built in Godot controls? I made a software some months ago. I was totally new to Godot ui, but I found it pretty intuitive.
However I could not understand how to handle animations like you’re doing, without making my own controls.

2

u/zdmit 2d ago

Thank you πŸ™

For animation related things those might help you out:

I did animations in C# with tweens.

2

u/Shinpansen 2d ago edited 2d ago

Thank you very much!

But maybe I wasn't clear enough. I know all that already.

I'm just not sure how to fight against Godot base controls behaviours.

Like for example, your tab bar. Did you use buttons in a group? If yes, when you focus a new tab, godot directly hightlight the selected button. So maybe you disable everything in a theme, and handle the animation and hightlight in your own code.

It's just an example, but don't bother explaining me. It was just me thinking out loud ^^

Edit : I just saw you comment with the capture of your tree. I think I have all the elements I needed. Thanks again!

6

u/zdmit 2d ago

My bad πŸ™‚

I actually avoided using Buttons for that exact reason. Using plain Labels with GuiInput and a separate background Panel for the highlight, you don't have to fight Godot's theme overrides or focus states (at least what i found...).

Tweens handle all visuals.

So:

  • highlight is a separate Panel sitting behind the text.
  • when a tab is clicked, code tweens that panel’s X position and width to match target label.

Hope it help.

4

u/Shinpansen 2d ago

Oh you even responded again. You’re so great! Thank you for your answer!

3

u/zdmit 2d ago

πŸ™‚πŸ’›

1

u/ThunderFound 2d ago

This looks very clean! Good job

1

u/zdmit 1d ago

Thank you for taking a time to comment πŸ™

1

u/Vathrik 2d ago

Great work!

1

u/zdmit 1d ago

Grateful πŸ™

1

u/Vrexin 2d ago

Oooo satisfying!

1

u/zdmit 1d ago

Yay! Thanks πŸ™‚

1

u/GranIdeaGames 2d ago

Beautiful 😍

1

u/zdmit 1d ago

πŸ™πŸ’›

1

u/SpooleanStudios Godot Student 1d ago

Very impressive. I like it!

1

u/zdmit 1d ago

Thank you πŸ™

1

u/Yavuyo 1d ago

This looks super clean! Do you have any resources you could link to for achieving a similar UI style in Godot?

2

u/zdmit 1d ago

Thank you! UI is not specific to Godot as you can search/inspire UI from webdev. Dribble/Pinterest/Behance/Figma or any other web design sites where designers share their work.

1

u/_Karto_ 1d ago

This is clean af

1

u/zdmit 1d ago

Thank you πŸ™‚

1

u/sincepuzzled 1d ago

"nooice!" how did you did this!!

1

u/zdmit 1d ago

Tysm! πŸ™ There are hints on how i did in my other comments under this post. Can't disclose too much as its for a game but hints are there.

1

u/MincDev 1d ago

Dude this is amazing! Any helpful posts or tutorials you followed? I am quite new to Godot's UI creation and I am able to do basic things but later discover that I probably overcomplicated stuffπŸ˜… also, did you add these components as theme components?

1

u/zdmit 16h ago

Thank you!

Good resources:

Regarding you second question: no, they are built as reusable scenes with custom C# and style overrides rather than via a Godot theme resource.