Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      CodeSOD: A Unique Way to Primary Key

      July 22, 2025

      BrowserStack launches Figma plugin for detecting accessibility issues in design phase

      July 22, 2025

      Parasoft brings agentic AI to service virtualization in latest release

      July 22, 2025

      Node.js vs. Python for Backend: 7 Reasons C-Level Leaders Choose Node.js Talent

      July 21, 2025

      The best CRM software with email marketing in 2025: Expert tested and reviewed

      July 22, 2025

      This multi-port car charger can power 4 gadgets at once – and it’s surprisingly cheap

      July 22, 2025

      I’m a wearables editor and here are the 7 Pixel Watch 4 rumors I’m most curious about

      July 22, 2025

      8 ways I quickly leveled up my Linux skills – and you can too

      July 22, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025
      Recent

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025

      Zero Trust & Cybersecurity Mesh: Your Org’s Survival Guide

      July 22, 2025

      Execute Ping Commands and Get Back Structured Data in PHP

      July 22, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025
      Recent

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025

      “I don’t think I changed his mind” — NVIDIA CEO comments on H20 AI GPU sales resuming in China following a meeting with President Trump

      July 22, 2025

      Galaxy Z Fold 7 review: Six years later — Samsung finally cracks the foldable code

      July 22, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Canvas App Components: A Crash Course for Power Apps Developers

    Canvas App Components: A Crash Course for Power Apps Developers

    May 17, 2025

    If you have experience in traditional software development, low-code tools may feel a bit sparse at first. But to many people’s surprise, traditional techniques often translate quite well to low-code development. Not always one-for-one – but usually close enough.

    One of the most fundamental tasks when building an application is breaking it down into its core parts, or components. Websites are constructed from smaller building blocks. Just how small? Well, that’s up to you, the developer.

    In the example below, we can spot some obvious elements: a header, a search box, perhaps a sidebar for navigation, and a main content area. Applications emerge from many smaller parts coming together.

    Image of components of a website

    Components allow us to isolate responsibility and manage complexity for specific parts of an application. In both traditional and low-code development, they play a vital role in creating maintainable, reusable, and testable products.

    In this article, you’ll learn what a component is. Then we’ll build a custom text field component inside a Canvas app.

    Prerequisites

    This tutorial assumes a basic understanding of Microsoft Power Apps. While not required to understand the article, to actively follow along, you’ll need access to a Power Platform environment with the App Maker security role.

    Table of Contents

    • The Concept of a Component

    • How to Build Your Own Component

    • Wrapping Up

    The Concept of a Component

    The idea of components isn’t new – and it’s not exclusive to software.

    Let’s think about a car for a moment. A car is made up of many smaller parts: wheels, an engine, seats, a steering wheel, and so on. But it’s the concept of the car – and specifically its ability to transport us – that provides value. That concept emerges from the way the individual parts work together.

    Now imagine you get a flat tire. Not a good day. But thanks to how cars are designed, you don’t need a whole new car – maybe not even a new tire. You fix the issue and you’re back on the road within a few hours. Breaking things into smaller parts helps make the whole system more resilient. Applying this same principle to application development is a smart, future-proof approach.

    Two Broad Types of Components

    Within an application, components can vary in complexity and responsibility. Some are simple, like a text label. Others are more complex, like a pop-up dialog. Regardless of their complexity (again, your design choice), components typically fall into one of two categories:

    • Presentational (“Dumb”) Components

    • Container (“Smart”) Components

    The difference comes down to purpose. A container component may interact with external sources and usually mutates state. A presentational component, on the other hand, is generally only responsible for how things look and light communication with the application.

    Container components are often more complex and harder to test. Presentational components are typically simpler and more predictable.

    This isn’t to say you should avoid container components. That’s not realistic. At some point, your app will need to talk to the outside world.

    Aside: Pure Functions

    The concept of pure functions is useful here.

    A function is considered pure if it always returns the same output for the same input and doesn’t interact with any external state.

    // Example 1 (pure)
    function add(x, y) {
      return x + y;
    }
    
    console.log(add(2, 3)); // Always 5
    
    // Example 2 (not pure)
    function subtract(x) {
      const y = Math.floor(Math.random() * 100) + 1; // Random number between 1 - 100
      console.log(y);
      return x + y;
    }
    
    console.log(subtract(5)); // Unpredictable
    

    Just like add() is pure and subtract() is not, a presentational component behaves like a pure function: same input, same output. The output might be how the UI appears or an event with associated data.

    More About Inputs and Outputs

    If you’ve built a Canvas App before, you’ve already used components – even if you didn’t realize it. Most controls in a Canvas App are presentational components.

    Take the Label control. It receives an input (Text) and renders output (the text on screen).

    Image of Canvas App label

    Events are another kind of output. For example, the Button control emits an event when clicked – handled through the OnSelect property. That property allows the app to respond to the click and perform some logic.

    Image of Canvas app button

    💡 When a component sends a message back to the application the component is said to have emitted an event.

    Now let’s look at the Text Input control.

    Like the others, it has inputs (like Placeholder). But it also emits a Change event via OnChange. Even better, it passes data back to the application through its Value property. As the user types, the value updates. That value is how we access what they typed.

    Image of Canvas app text input

    How to Build Your Own Component

    Let’s build a simple, customized input component. It will include:

    • A label above the input

    • Optional “required” validation

    • Change detection and data output

    Here is what it will look like:

    Image of custom text field to be built

    Part 1: Create the Component

    1. Navigate to the Components section of your Canvas App.

    2. Add a new component and name it cmp_baseInput.

    3. Resize it to 340 (w) x 100 (h).

    Image of how to create a component

    Part 2: Add Controls

    1. Add a Text Input control, centered.

    2. Add two Labels—one above, one below the input.

    3. Rename them:

      • lbl_label

      • lbl_hint

      • txt_textField

    Image of the appropriate controls added to the component

    Part 3: Add Custom Properties

    Add four properties to the component. We’re primarily concerned with the Property Type, Property Definition, and Data Type properties.

    • IsRequired (Data, Input, Boolean)

    • Label (Data, Input, Text)

    • Value (Data, Output, Text)

    • OnChange (Event)

    Image of custom properties added to the component

    Part 4: Connect the Properties

    Set the control’s properties as follows.

    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: Style It

    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

    1. Go back to the application screen.

    2. Insert the component and name it cmp_userName.

    3. Add a label nearby and set its text to:
      "The user name is: " & cmp_userName.Value

    Image of inserting the component in the application

    Image of the component inserted into the application

    Part 7: Test It

    • Type in the component and click outside of it → label near the component updates and the hint disappears.

    • Clear the text → hint reappears

    • Set IsRequired to false → hint disappears

    • Set OnChange to Notify("A change occurred!") and type in the input→ a toast message appears with you notification.

    Wrapping Up

    You’ve just created a functional, presentational component. It handles labels, validation, value output, and even events – all in one package.

    This is the real power of components: abstraction, clarity, and reusability. Whether you’re in a traditional or low-code environment, thinking in components helps you break complexity into manageable parts.

    As your apps grow, this mindset will pay off. You’ll spend less time rewriting logic and more time building value – one well-defined part at a time.

    Enjoyed this article? I write regularly about low-code, development patterns, and practical tech topics at scriptedbytes.com

    Stay curious and keep building.

    Source: freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleI’m a TV expert and these are my favorite Memorial Day TV deals: Save up to $2,500 on Sony, Samsung, and more
    Next Article How to Write Math Equations in Google Docs

    Related Posts

    Development

    GPT-5 is Coming: Revolutionizing Software Testing

    July 22, 2025
    Development

    Win the Accessibility Game: Combining AI with Human Judgment

    July 22, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    Anthropic’s MCP Server Vulnerability Allowed Attackers to Escape Sandbox and Execute Code

    Security

    DHS Warns Pro-Iranian Hackers Likely to Target U.S. Networks After Iranian Nuclear Strikes

    Development

    AlmaLinux 10: Guida post installazione

    Linux

    CVE-2025-42992 – SAPCAR Privilege Escalation Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    CVE-2025-7765 – Code-projects Online Appointment Booking System SQL Injection

    July 17, 2025

    CVE ID : CVE-2025-7765

    Published : July 17, 2025, 11:15 p.m. | 2 hours, 7 minutes ago

    Description : A vulnerability classified as critical was found in code-projects Online Appointment Booking System 1.0. Affected by this vulnerability is an unknown functionality of the file /admin/addmanagerclinic.php. The manipulation of the argument clinic leads to sql injection. The attack can be launched remotely. The exploit has been disclosed to the public and may be used.

    Severity: 7.3 | HIGH

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    MediaTek’s June 2025 Security Bulletin: High-Severity Flaw & Multiple Medium Risks Uncovered

    June 2, 2025

    CVE-2025-41407 – Zohocorp ManageEngine ADAudit Plus SQL Injection Vulnerability

    May 23, 2025

    Rilasciata Rocky Linux 10: La Nuova Alternativa Libera a Red Hat Enterprise Linux 10

    June 12, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.