Files
noodl-docs/docs/guides/user-interfaces/visual-states.md
Eric Tuvesson 53f0d6320e Initial commit
Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com>
Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com>
Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com>
Co-Authored-By: Michael Cartner <32543275+michaelcartner@users.noreply.github.com>
2023-09-05 12:08:55 +02:00

71 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Visual States
hide_title: true
---
# Working with Visual States
## What you will learn in this guide
This guide will teach you how to style **Visual nodes** differently based on user interaction.
## Overview
We will go through the following steps in this guide:
- Create a button
- Style its `neutral` state
- Style it differently in its `hover` state
There is also a video walking through the guide.
<iframe width="560" height="315" src="https://www.youtube.com/embed/ATyqeK_deu4" title="YouTube video player" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen></iframe>
## Let's go!
When working with Visual nodes we often find ourselves in situations where we want to style the node differently based on the user interaction. We might want to have a different background color when hovering a button, or indicating that a checkbox has been checked. This is done using **Visual States** in the nodes settings in the **Property Panel**.
Lets create a button in our node tree, and give it a quick styling.
<div className="ndl-image-with-background">
![](/docs/guides/user-interfaces/visual-states/node-created.png)
</div>
Our brand guidelines tell us that all buttons need to be the Dark color and that they shouldn't have any rounded corners.
<div className="ndl-image-with-background s">
![](/docs/guides/user-interfaces/visual-states/wrong-hover.gif)
</div>
Ok, so, it looks good now, but when I sent it to my designer friend they told me that while the button looked good in the neutral state, it was all wrong when hovered. The button is supposed to be the Primary Light color, and the text should be Dark. Lets fix that by modifying the Hover state.
With the Button node still selected, lets move over to the Visual State selector and click the Hover option.
<div className="ndl-image-with-background">
![](/docs/guides/user-interfaces/visual-states/states.png)
</div>
We will see the Property Panel shift around a bit. Some properties just don't make any sense to change in an interaction state, so Noodl will hide those properties for us.
Lets scroll down to the properties for Label and Background Color and update them.
<div className="ndl-image-with-background l">
![](/docs/guides/user-interfaces/visual-states/update-states.png)
</div>
And voila - we are now following the brand guidelines.
<div className="ndl-image-with-background s">
![](/docs/guides/user-interfaces/visual-states/right-hover.gif)
</div>