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

      The Psychology Of Color In UX Design And Digital Products

      August 15, 2025

      This week in AI dev tools: Claude Sonnet 4’s larger context window, ChatGPT updates, and more (August 15, 2025)

      August 15, 2025

      Sentry launches MCP monitoring tool

      August 14, 2025

      10 Benefits of Hiring a React.js Development Company (2025–2026 Edition)

      August 13, 2025

      Your smart home device just got a performance and security boost for free

      August 18, 2025

      Ultrahuman brings advanced cycle and ovulation tracking to its smart ring

      August 18, 2025

      DistroWatch Weekly, Issue 1135

      August 17, 2025

      14 secret phone codes that unlock hidden features on your Android and iPhone

      August 17, 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

      Air Quality Prediction System using Python ML

      August 17, 2025
      Recent

      Air Quality Prediction System using Python ML

      August 17, 2025

      AI’s Hidden Thirst: The Water Behind Tech

      August 16, 2025

      Minesweeper game in 100 lines of pure JavaScript – easy tutorial

      August 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      DistroWatch Weekly, Issue 1135

      August 17, 2025
      Recent

      DistroWatch Weekly, Issue 1135

      August 17, 2025

      Ubuntu’s New “Dangerous” Daily Builds – What Are They?

      August 17, 2025

      gofmt – formats Go programs

      August 17, 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

    Artificial Intelligence

    Scaling Up Reinforcement Learning for Traffic Smoothing: A 100-AV Highway Deployment

    August 18, 2025
    Repurposing Protein Folding Models for Generation with Latent Diffusion
    Artificial Intelligence

    Repurposing Protein Folding Models for Generation with Latent Diffusion

    August 18, 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

    AI-Driven Human Hacking is a New Frontier in Cybersecurity

    Development
    Firebase & MongoDB Atlas: A Powerful Combo for Rapid App Development

    Firebase & MongoDB Atlas: A Powerful Combo for Rapid App Development

    Databases
    T* and LV-Haystack: A Spatially-Guided Temporal Search Framework for Efficient Long-Form Video Understanding

    T* and LV-Haystack: A Spatially-Guided Temporal Search Framework for Efficient Long-Form Video Understanding

    Machine Learning

    CVE-2025-4440 – H3C GR-1800AX Buffer Overflow Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    CVE-2025-53612 – Apache HTTP Server Denial of Service

    July 8, 2025

    CVE ID : CVE-2025-53612

    Published : July 8, 2025, 3:15 a.m. | 3 hours, 36 minutes ago

    Description : Rejected reason: Not used

    Severity: 0.0 | NA

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

    With 5 min EV-charging and $9M revenue, Nyobolt secures $30M to scale high-power battery tech

    April 16, 2025

    CVE-2025-3853 – WordPress WPshop E-Commerce Plugin Insecure Direct Object Reference Vulnerability

    May 6, 2025

    CVE-2025-52878 – JetBrains TeamCity Unauthenticated Username Exposure

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

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