|
| 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 | + |
| 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 | +  |
| 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 | +  |
| 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 | + |
| 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 | + |
| 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 | + |
| 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 | + |
| 106 | + |
| 107 | +Select **Review**, and you'll see the option to update the component: |
| 108 | + |
| 109 | + |
| 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 | +  |
| 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 | +  |
| 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