Let’s make an adjustable window! 🎛️
In this lesson, we’ll create a window that has settings to adjust its properties.
Create a new React﹤Kitten﹥ project
First, create a new React﹤Kitten﹥ project by running the following command:
Install React﹤Kitten﹥
Next, install React﹤Kitten﹥ by running the following command:
Let’s start with creating the most basic window
We’ll use Kitten’s usePosition
hook for the window’s position, useSize
for the window’s size, and React’s useState
for the rest.
Here is our window:
Now, we want to add settings to adjust the window’s properties.
Add settings to adjust the window
We’ll add a Settings
component to the Window
component.
We’ll write some JSX code to create a form with input fields to adjust the window’s properties in the <Content>
component.
Setting position
, size
, and staged
We’ll add input fields to adjust the window’s position
, size
, and staged
properties.
Here is the full code:
Congratulations! 🥳 You’ve created an adjustable window with settings to adjust its properties.