You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Learn how to build a card with buttons.
4
4
ms.date: 09/20/2022
5
5
ms.topic: article
@@ -11,12 +11,66 @@ ms.custom:
11
11
ms.collection:
12
12
---
13
13
14
-
# Use buttons
14
+
# Add buttons
15
15
16
-
Buttons let users perform actions in you card. Buttons can do one of four things:
16
+
Buttons are a type of control that let users perform actions in cards. They're a visual interface that makes it easy for users to do things with cards without entering any input aside from a click.
17
+
18
+
Buttons can do one of four things:
17
19
18
20
1. Run Power Fx - when selected, the button will run a [Power Fx formula](../power-fx/intro-to-pfx.md)
19
-
1. Show Screen - when selected, the button will navigate to the specified screen
21
+
1. Show Screen - when selected, the button will go to the specified screen
20
22
1. Open Url - when selected, the button will launch the given url in an external or embedded web browser
21
23
1. Toggle Visibility - when selected, the button will show or hide other controls in the card
22
24
25
+
## Prerequisites
26
+
27
+
- A [Power Apps](https://powerapps.microsoft.com/) account.
28
+
- A card. For an example, see the [simple card tutorial](../../tutorials/hello-world-card.md).
29
+
- Familiarity with the [Card Designer](../designer-overview.md).
30
+
31
+
## Add a button to a card
32
+
33
+
1. Go to [Power Apps](https://powerapps.microsoft.com/). Select **Cards (Preview)** and then the card you want add a button to.
34
+
1. Select **+ Insert** on the left. Then select **Button** to add a button to your card.
35
+
36
+
:::image type="content" source="../../media/use-buttons/add-button.png" alt-text="Screenshot of Button in Insert menu":::
37
+
38
+
1. Now that the button is on your card, you can edit its properties. At a minimum, choose a button **Type** and add a button **Title** to display on the card, as shown below.
39
+
40
+
:::image type="content" source="../../media/use-buttons/button-title.png" alt-text="Screenshot of button title change":::
41
+
42
+
### Button type
43
+
44
+
There are four types of buttons you can add to your card:
45
+
46
+
- Run PowerFx
47
+
- Show Screen
48
+
- Open Url
49
+
- Toggle Visibility
50
+
51
+
#### Run PowerFX
52
+
53
+
The **Run PowerFX** button type lets you use buttons to run Power Fx formulas. These formulas can be simple or complex, and when combined with buttons make it easy for users to navigate card logic.
54
+
55
+
Set the **Type** to **Run PowerFX**. Then select the **Power Fx** link to add a formula to the Formula bar.
56
+
57
+
When you test the button, the actions expressed by the Power Fx formula should happen.
58
+
59
+
#### Show Screen
60
+
61
+
The **Show Screen** button lets users select a button and then display a screen. For more information about screens, see the [screens](../screens/use-screens.md) article.
62
+
63
+
Set the **Type** to **Show Screen** and then select a **Screen** to switch to. If you don't have any screens, only **main** will appear in the list. When the user selects the button, the new screen will appear under the card.
64
+
65
+
#### Open Url
66
+
67
+
The **Open Url** button lets users select a button that opens a URL.
68
+
69
+
Set the **Type** to **Open Url** and then enter a **Url**. When the user selects the button, the URL entered previously will open.
70
+
71
+
#### Toggle Visibility
72
+
73
+
The **Toggle Visibility** button shows or hides other controls in the card.
74
+
75
+
Set the **Type** to **Toggle Visibility**. Then select the **Target Elements** pane and select **+ Add new**. Enter the **ElementID** and toggle the **Visibility** property to make the element visible or invisible. Add as many elements as you want to toggle the visibility of.
Copy file name to clipboardExpand all lines: powerapps-docs/cards/make-a-card/variables/variables.md
+44-3Lines changed: 44 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,6 @@
1
1
---
2
-
title: "Using variables"
3
-
description: "Learn about storing data in variables"
4
-
keywords: "Card Designer, Power Apps, cards, variables"
2
+
title: Use variable
3
+
description: Learn about storing data in variables
5
4
ms.date: 09/20/2022
6
5
ms.topic: article
7
6
author: iaanw
@@ -17,3 +16,45 @@ ms.collection:
17
16
Variables are used to store data within the context of a card. That data can be of different types like table, text, or a number. The value can also be temporary, where it resets for every card session, or permanent, where it is shared across all sessions for a specific card instance. Variables have unique names, which is how they are referenced in [formulas](../../make-a-card/power-fx/intro-to-pfx.md).
18
17
19
18
For example, if you wanted a card that counted how many times a user pressed a button during a session, you would create a temporary number variable. If you wanted to capture the name of the last user to press a button for a card instance, you would use a permanent text variable. If you wanted to save data between card instances, you would use a [data connection](../connectors/connector-intro.md).
19
+
20
+
## Prerequisites
21
+
22
+
- A [Power Apps](https://powerapps.microsoft.com/) account.
23
+
- A card. For an example, see the [simple card tutorial](../../tutorials/hello-world-card.md).
24
+
- Familiarity with the [Card Designer](../designer-overview.md).
25
+
26
+
## Add a variable
27
+
28
+
To add variables in cards, do the following.
29
+
30
+
1. Go to [Power Apps](https://make.test.powerapps.com/) and select **Cards (preview)**.
31
+
1. On the left, select **Cards** and select the card you want to test add a connector to.
32
+
1. On the left, select **Variables**. Then select **+ New variable**.
33
+
34
+
:::image type="content" source="../../media/variables/new-variable.png" alt-text="Screenshot of the + Add variable button":::
35
+
36
+
1. The **New variable** window will appear. Set the following values:
37
+
-**Name**: the name of your variable.
38
+
-**Type**: the type of variable.
39
+
-**Default value**: the default value of the variable, prior to input.
40
+
-**Value Persistance**: whether the variable is temporary (resets every time the card's opened) or permanent.
41
+
42
+
You can also customize sender options, as well as the **Title** and **Description** of the variable. These may be helpful for testing and debugging.
43
+
1. After you've entered everything select **Save**. The new variable will appear in the **Variables** list and can be used anywhere in your card.
44
+
45
+
### Edit and delete variables
46
+
47
+
If you want to to edit or delete a variable, select the three dots next to the variable and choose the option that works for you.
48
+
49
+
:::image type="content" source="../../media/variables/edit-delete-variable.png" alt-text="Screenshot of the Edit and Delete variable button":::
50
+
51
+
>[!NOTE]
52
+
> After creation, the variable **Name** and **Type** cannot be edited. If you need to change these values, create a new variable.
53
+
54
+
## Use variables in cards
55
+
56
+
There are a variety of ways to use variables in cards. The most common option is memory storage, especially for user input.
57
+
58
+
To use variables in Power Fx expressions simply add the variable name to your formula. For an example, see the [simple card tutorial](../../tutorials/hello-world-card.md). Your variables should be recognized in the formula bar as well, shown below:
59
+
60
+
:::image type="content" source="../../media/variables/formula-bar-example.png" alt-text="Screenshot of auto-filling variable name in formula bar button":::
0 commit comments