If you have experience in traditional software development, low code tools may feel a bit wrecking first. But the surprise of many people is that traditional techniques often translate largely translated into low code development. Not always for one-but usually close enough.
When building an application, the most basic task is breaking it into its core parts, or components. Websites are built from small building blocks. Just how small? Well, it depends on you, the developer.
In the example below, we can see some obvious elements: a header, a search box, probably a sidebar for navigation, and a major material area. Applications emerge from many small parts that come together.
Ingredients allow us to isolate responsibility for specific parts of an application and manage complexity. In both the traditional and low code development, they play an important role in creating a capable, usable and tested product.
In this article, you will know what a component is. Then we will make the custom text field part of the canvas app.
Provisions
This tutorial assumes the basic understanding of Microsoft Power Apps. Although this article does not need to be understood, to actively follow it, you will need access to the power platform environment with the role of app maker security.
The table of content
The concept of a component
The idea of ​​components is not new – and this is not special for software.
Let’s think about a car for a moment. A car consists of many small parts: wheels, one engine, seats, a steering wheel, etc. But this is the concept of a car – and especially its ability to carry us – which gives us the value. This concept emerges in a way to work with the individual.
Now imagine that you get a flat tire. Not a good day But thanks to how the cars are designed, you don’t need a whole new car – maybe even a new tire. You fix this problem and you return to the road within a few hours. Breaking things into smaller parts help make the entire system more flexible. Applying the same principle to application development is a clever, future proof.
Two wide variety of ingredients
Within an application, the ingredients may vary in complexity and responsibility. Some are easy, such as text labels. Other popups are more complicated as dialogue. Regardless of their complexity (once again, choosing your design), the ingredients usually come in one of the two types:
The difference comes down for purpose. The component of the container can interact with external sources and usually change the state. On the other hand, a presentation component is usually just responsible for how things look and light contact with application.
Container ingredients are often more complicated and difficult to test. Presentational ingredients are usually easy and more forecast.
This is not to say that you should avoid container ingredients. This is not realistic. At one time, your app will need to talk to the outside world.
One side: pure functions
Imagine Pure functions Here is useful.
A function is considered Sincere If it always returns the same output for the same input and does not interact with any external state.
function add(x, y) {
return x + y;
}
console.log(add(2, 3));
function subtract(x) {
const y = Math.floor(Math.random() * 100) + 1;
console.log(y);
return x + y;
}
console.log(subtract(5));
Prefer exactly add()
Is pure and subtract()
Not, the component of a presentation behaves like a pure function: one input, one output. Output may appear how the UI appears or an event of the data associated with it.
More about inputs and consequences
If you have created the first canvas app, you have already used the ingredients – even if you do not realize it. The Canvas app has mostly controlled components.
L Label Control it receives an input (Text
) And offers (text on the screen).
Events are another type of product. For example, Button When clicked, the control emits an event. OnSelect
The property allows the property app to respond to the click and perform some logic.
💡 When a component sends a message on the request, it is said that components are considered An incident was discharged.
Now we see Text input Control
Like others, input in it (such as Placeholder
) But it is also excluded A Change
Through the event OnChange
. Even better, it returns the data into the application through it Value
The property is a user type, updating the value. The cost of this value is how we access them.
How to make your component
Let’s make a simple, customized input component. Will include:
This is what will look:
Part 1: Make the ingredient
Navigrates on Ingredient Your Canvas App Section.
Add a new component and tell its name
cmp_baseInput
.Give it to 340 (W) X 100 (h).
Part 2: Add control
Add A Text input Control, focus.
Add two LabelAbove one above, one under the input.
Change their name:
lbl_label
lbl_hint
txt_textField
Part 3: Add Customs Properties
Add four features to the ingredient. We are mainly related to property type, property definition, and data type properties.
IsRequired
(Data, input, boulin)Label
(Data, input, text)Value
(Data, output, text)OnChange
(Event)
Part 4: Connect properties
Set the control features as the following.
lbl_label.Text = cmp_baseInput.Label
lbl_hint.Text = "This field is required."
lbl_hint.Visible = cmp_baseInput.IsRequired And Len(txt_textField.Value) < 1
txt_textField.OnChange = cmp_baseInput.OnChange()
cmp_baseInput.Value = txt_textField.Value
cmp_baseInput.Label = "Placeholder Label"
Part 5: Styling its
lbl_label.Size = 12
lbl_label.Height = 24
lbl_label.FontColor = RGBA(122, 138, 143, 1)
lbl_hint.Size = 10
lbl_hint.Height = 24
lbl_hint.FontColor = RGBA(215, 58, 60, 1)
lbl_hint.FontWeight="TextCanvas.Weight".Semibold
Part 6: Add it to the app
Return to the application screen.
Insert the component and tell his name
cmp_userName
.Add a label near and set his text on it:
"The user name is: " & cmp_userName.Value
Part 7: Test this
Type in the component and click outside → Label near the component’s refreshments and the gesture disappears.
Clean the text → Hint appears again
Set
IsRequired
False → gesture disappearsSet
OnChange
toNotify("A change occurred!")
And type in input → A toast message appears with your notification.
Wrap
You have just created a functional, presentation component. It handles label, verification, value output, and even events – all in the same package.
This is the real strength of the ingredients: summary, explanation and re -prevailing. Whether you are in a traditional or low -code environment, thinking in ingredients helps you eliminate complexity in manageable parts.
As your apps grow, this mentality will disappear. You’ll just spend less time at the cost of rewriting logic and making more time-a well-defined part at a time.
Enjoy this article? I regularly write about low code, development patterns and practical tech topics Scriptted bytes dot com
Stay curious and build.