Skip to content

Commit 257bbcf

Browse files
authored
Merge pull request #2408 from MicrosoftDocs/canvasapp-component-library
Canvasapp component library
2 parents 45ebef3 + 06135d2 commit 257bbcf

31 files changed

+270
-54
lines changed

powerapps-docs/maker/TOC.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,10 @@
879879
href: ./canvas-apps/dev-appsource-test-drive.md
880880
- name: Create a component
881881
items:
882-
- name: Overview
882+
- name: Components overview
883883
href: ./canvas-apps/create-component.md
884+
- name: Component library
885+
href: ./canvas-apps/component-library.md
884886
- name: Behavior formulas
885887
href: ./canvas-apps/component-behavior.md
886888
- name: Embed canvas apps in your applications

powerapps-docs/maker/canvas-apps/component-behavior.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: Behavior formulas for components | Microsoft Docs
3-
description: Trigger an app to perform one or more tasks when a component-based action occurs.
3+
description: Do one or more tasks in canvas app when a component-based action occurs.
44
author: yifwang
55
ms.service: powerapps
66
ms.topic: article
7-
ms.date: 9/30/2019
7+
ms.date: 02/20/2020
88
ms.author: yifwang
99
ms.reviewer: tapanm
1010
search.audienceType:
@@ -16,9 +16,11 @@ search.app:
1616
# Behavior formulas for components
1717

1818
> [!IMPORTANT]
19-
> This feature is still experimental and disabled by default. For more information, see [Experimental and preview features](working-with-experimental.md).
19+
> This feature is still in public preview. For more information, see [Experimental and preview features](working-with-experimental.md).
2020
21-
Specify one or more [behavior formulas](working-with-formulas-in-depth.md) that run when an event triggers a change in component instances. For example, set a component's **OnReset** property to one or more formulas that perform initialization, clear input, and reset values when the **Reset** function runs on the component instances.
21+
Specify one or more [behavior formulas](working-with-formulas-in-depth.md) that run when an event triggers a change in component instances.
22+
23+
For example, set a component's **OnReset** property to one or more formulas that do initialization, clear input. And reset values when the **Reset** function runs on the component instances.
2224

2325
## OnReset
2426

@@ -43,7 +45,7 @@ To trigger reset, go to a screen and insert an instance of the component. Add a
4345
4446
## Update OnReset using custom property
4547

46-
Besides resetting a component instance from the outside of the component, there is another method to trigger the OnReset from the inside. "**Raise OnReset when value changes**" is an option when creating a custom input property, and it allows the value changes of this property to trigger OnReset of the component. This method is designed to set and reset default value easily.
48+
Besides resetting a component instance from the outside of the component, there's another method to trigger the OnReset from the inside. "**Raise OnReset when value changes**" is an option when creating a custom input property. And it allows the value changes of this property to trigger OnReset of the component. This method is designed to set and reset default value easily.
4749

4850
> ![OnReset example](./media/component-behavior/property-trigger.png)
4951
@@ -52,6 +54,11 @@ Besides resetting a component instance from the outside of the component, there
5254
> [!div class="mx-imgBorder"]
5355
> ![OnReset example](./media/component-behavior/updateordernumber2.gif)
5456
55-
This is an example of reviewing order numbers and updating the numbers. The numeric up and down component is used to increase or decrease number of orders. When selecting the gallery on the left, the default number of numeric up and down component is reset to display the order number of selected tool. "**Raise OnReset when value changes**" made it possible to reset the default value when the input changes.
57+
Example above shows reviewing order numbers and updating the numbers. The numeric up and down component is used to increase or decrease number of orders. When selecting the gallery on the left, the default number of numeric up and down component is reset to display the order number of selected tool. "**Raise OnReset when value changes**" made it possible to reset the default value when the input changes.
5658

5759
To do so, check "**Raise OnReset when value changes**" of the default input property. **OnReset** of the component is set to **Set(_numericValue,'Numeric up down'.DefaultValue)**. _numericValue is the variable to store the value of the current order value. And set the **Default** of the text input control to **If(IsBlank(_numericValue), 'Numeric up down'.DefaultValue, _numericValue)**.
60+
61+
### See also
62+
63+
- [Canvas app components overview](create-component.md)
64+
- [Canvas app components library](component-library.md)
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
title: Create a component library for canvas apps | Microsoft Docs
3+
description: Library of reusable components for canvas apps
4+
author: yifwang
5+
ms.service: powerapps
6+
ms.topic: article
7+
ms.date: 02/20/2020
8+
ms.author: yifwang
9+
ms.reviewer: tapanm
10+
search.audienceType:
11+
- maker
12+
search.app:
13+
- PowerApps
14+
---
15+
16+
# Component library
17+
18+
> [!IMPORTANT]
19+
> This feature is still in public preview. For more information, see [Experimental and preview features](working-with-experimental.md).
20+
21+
In the [overview](create-component.md) article for creating components, you are introduced to components inside canvas app. As you create components inside an app, you can also create a library of components that can be reused. By creating a component library, app makers easily share and update one or more components with other makers.
22+
23+
Component libraries are containers of component definitions that make it easy to:
24+
25+
- Discover and search components.
26+
- Publish updates across environments.
27+
- Notify app makers of available component updates.
28+
29+
> [!NOTE]
30+
> Component libraries are the recommended way to reuse components across apps. When using component library, an app maintains dependencies on the components it uses. The app maker will be alerted when the updates to dependent components become available. Hence, all new reusable components should be created within the component libraries instead. An earlier Power Apps feature that allowed [importing components from one canvas app to another](create-component.md?#import-and-export-components) will be deprecated.
31+
32+
## Difference between an app and a component library
33+
34+
A component library provides a centralized and managed repository of components for reusability.
35+
36+
**Insert** pane on left navigation defaults to components tab if you create a component library. When you create an app, this view shows screens instead of components.
37+
38+
The screens inside a component library are available for testing only. It provides library creators a way to quickly test the created components on actual screen and also validate the update behavior as components are enhanced over time. To use the components from component library, you must create an app that uses component library.
39+
40+
You can preview component library components using the screens inside the library with the play option. When you select component tab, the play option is disabled. Component library doesn't display when using Power Apps mobile.
41+
42+
> [!NOTE]
43+
> Component library discussed in this article is different from the Power Apps Component Framework that enables developers and makers to create code components for model-driven and canvas apps. For more information, read [Power Apps Component Framework overview](https://docs.microsoft.com/powerapps/developer/component-framework/overview).
44+
45+
## Working with component library
46+
47+
You can create a new component library or edit an existing component library from the same interface. Browse to [make.powerapps.com](https://make.powerapps.com), select **Apps**, and then select **Component Libraries**:
48+
49+
![Create or edit component library](./media/component-library/create-edit-component-library.png)
50+
51+
## Create an example component library
52+
53+
The steps to create components inside a component library are same as creating components inside an app. You'll create a component library. And then reuse the steps for creating components from [components overview example](create-component.md#create-an-example-component). And then you'll use the component library to provide the reusable components in a new app.
54+
55+
1. Sign in to [make.powerapps.com](https://make.powerapps.com).
56+
57+
1. select **Apps** in left navigation, select **Component Libraries**, and then select **New component library**.
58+
59+
1. Name the component library as *Menu components*; you can also provide a different name of your choice.
60+
61+
1. Follow the steps to create components from [components overview example](create-component.md#create-an-example-component). You don't have to open Power Apps Studio or create a new blank app, since you already have created a new component library. Start with step 2.
62+
63+
After following steps to create components, follow next set of steps to also [add components to a screen](create-component.md#add-component-to-a-screen) the steps to [create output property](create-component.md#create-and-use-output-property).
64+
65+
1. After you completed the components creation and testing, save the component library by selecting **File** menu and then selecting **Save**.
66+
67+
You also have an option to save a **Version note**. Version note is useful to retrieve versions of a component library. And when upgrading the components used in apps from this component library.
68+
69+
![Version note when saving component library](./media/component-library/save-component-libray-version-note.png)
70+
71+
> [!TIP]
72+
> Version note is useful when reviewing versions of a component library and for the app makers using your component library to review changes and update apps consuming these components as needed. Read [update a component library](component-library.md?#update-a-component-library) for more details.
73+
74+
1. Saved component library can be published. Only published component library updates are available for apps that consume a component library. Select **Publish** to publish the component library version:
75+
76+
![Publish component library version](./media/component-library/publish-component-library.png)
77+
78+
## Import from a component library
79+
80+
After you create a component library and publish, apps can consume the components from this component library by importing the library. You can also [share a component library](component-library.md#component-library-permissions).
81+
82+
To import from a component library, edit an existing app or create a new app. After app opens in canvas app studio, select **Insert** or the **+** on the left navigation. And then select **Get more components** to list the component libraries available in current environment:
83+
84+
![Get more components](./media/component-library/get-more-components.png)
85+
86+
You'll see the list of component libraries available in current environment on right side of the screen. Select an individual component from a component library. Or use **Select all** to import all of the components from the library at once:
87+
88+
![Import components](./media/component-library/components.png)
89+
90+
> [!NOTE]
91+
> If maker doesn't see the component library listed in import section, ensure the component library is shared with the maker. For more details, read [component library permissions](component-library.md#component-library-permissions).
92+
93+
Notice you can select and import more than one component and across different component libraries.
94+
95+
Components available inside the app are listed under **Custom** category in list of components in the **Insert** pane. Components available from imported component libraries are listed under **Library components** category:
96+
97+
![Insert components to the app](./media/component-library/insert-components.png)
98+
99+
## Update a component library
100+
101+
You can modify existing component library and save any changes with additional version notes. However, the updated component library version must be published for use in existing apps that use the component library. [Example component library](component-library.md#create-an-example-component-library) steps above explain how to publish a component library after saving it.
102+
103+
Makers of other apps are notified of updated components being available. The notification appears when makers edit the apps in canvas app studio. And can choose to update the components:
104+
105+
![Update available](./media/component-library/update-available.png)
106+
107+
Select **Review**, and you'll see the option to update the component:
108+
109+
![Update component](./media/component-library/update-components.png)
110+
111+
Notice the version note you added when publishing component library version shows up here.
112+
113+
Select **Update** to update the components.
114+
115+
## Component library permissions
116+
117+
Sharing a component library works the same way you share a canvas app. When you share a component library, you allow others to reuse the component library. Once shared, others can edit the component library and import components from this shared component library for creating and editing apps. If shared as co-owner, user can use, edit, share component library but not delete or change owner.
118+
119+
## Known limitations
120+
121+
- [Known limitations](create-component.md#known-limitations) applicable to components also applies to component library.
122+
- You can't import components using component library from locally saved component library file. If you try to import a locally saved component library using **File** -> **Save As** -> **This Computer** and download the component library file as an app, following error message appears:
123+
124+
![Import component library file](./media/component-library/import-component-library-file.png)
125+
126+
- You can't add existing component libraries to a [solution](add-app-solution.md). However, you can create new component libraries for solutions using add component library flow.
127+
128+
- If you import a component from a component library, you can't edit it inside the consuming app. If you select **Edit component**, you'll see an option to create a copy of the component inside current app for you to make changes:
129+
130+
![Edit library component](./media/component-library/edit-library-component.png)
131+
132+
If you select **Create a copy**, the component is copied to the local app. The local copy of the component appears under the **Custom** category in the **Insert** pane. This local copy of the component won't receive updates if a new version of the originating component library is published later.
133+
134+
- When a component is added to an app from the component library and the theme of the app is updated, the component becomes a local app component and is no longer associated to the master component in the component library.
135+
136+
## Next steps
137+
138+
Learn [behavior formulas](component-behavior.md) for canvas app.
139+
140+
### See also
141+
142+
Read canvas app [components overview](create-component.md) and working with components in an app.

0 commit comments

Comments
 (0)