NewPower Apps · canvas componentNavigation and layout✓ Tested in StudioMIT License
Accordion
Expandable sections from a table of titles and text, one open at a time or several, each growing to fit its text; OpenKeys and OnToggle for your app, Toggle, ExpandAll and CollapseAll from it; keyboard-operable headers that say expanded or collapsed; light and dark.
- Name in Studio
- lcsAccordion
- Version
- 0.1.0
- Properties
- 7 inputs · 2 outputs · 1 event · 3 actions
Variations
As it is when you paste it, with every input at its default.
OpenKeys: "" · OpenCount: 0
Formulas on this screen
Set the same ones in Studio to try it the same way; there, each Notify shows its event in a banner, which this preview leaves out so nothing covers the component. The instance names are the ones Studio gives the first copy on a screen.
Text1.Text = "OpenKeys: """ & lcsAccordion_1.OpenKeys & """ · OpenCount: " & lcsAccordion_1.OpenCount
lcsAccordion_1.OnToggle = Notify(Key & If(IsOpen, " opened", " closed"))
A web replica that behaves as the component does in Power Apps. In Studio it uses Microsoft's controls, which can look slightly different.
Add it in five steps
- In Power Apps Studio, open Settings > Updates and check that Modern controls and themes and Enhanced component properties are on.
- Open the Components tab in the tree view and select New component.
- Select an empty part of Studio, so the new component isn't selected.
- Copy the YAML on this page and press Ctrl+V.
lcsAccordionappears with all its properties. - On a screen, insert it from Insert > Custom >
lcsAccordion.
What it needs
- No premium licence: standard controls, no connectors
- Modern controls and themes: on
- Enhanced component properties: on
- Tested in Power Apps Studio 3.26094.9 on October 13, 2026
- Version 0.1.0
Properties (13)
Read from the component's own YAML, so they always match what you paste.
| Property | Kind | Type | Default |
|---|---|---|---|
ItemsThe sections, as a table with Key, Title and Body columns, such as Table({Key: "hours", Title: "Opening hours", Body: "Weekdays 8 to 6."}). | Input | Table | Table({Key: "what", Title: "What is this app for?", Body: "Raising and tracking requests with the facilities team, from a broken light to a new desk. Every request gets a number and you can see its status here."}, {Key: "who", Title: "Who can see my request?", Body: "You, the facilities team and your manager. Nobody else, unless you add them."}, {Key: "long", Title: "How long does it take?", Body: "Most requests are closed within three working days. Urgent ones are picked up within the hour during opening hours."}) |
MultipleOpenLets several sections be open at once. Off, opening one closes the others. | Input | Boolean | false |
DefaultOpenKeysThe sections open when the screen loads, by Key, separated by commas. | Input | Text | "" |
BodySizeThe text size of a section's body. | Input | Number | 14 |
AccentColorYour brand colour, for the open section's chevron circle and the focus ring. | Input | Color | RGBA(15, 108, 189, 1) |
ThemeLight, or Dark for a dark screen. | Input | Text | "Light" |
MotionThe chevron's circle pops in as a section opens. None plays for people who've asked their device for reduced motion. | Input | Boolean | true |
| Property | Kind | Type | Default |
|---|---|---|---|
OpenKeysThe open sections' keys, separated by commas; empty when all are closed. | Output | Text | — |
OpenCountHow many sections are open. | Output | Number | — |
| Property | Kind | Type | Default |
|---|---|---|---|
OnToggle(Key, IsOpen)Runs in your app when a section opens or closes, with its key and whether it's open now.
| Event | — | false |
| Property | Kind | Type | Default |
|---|---|---|---|
Toggle(Key)Opens a section, or closes it if it's open, by Key, such as from a link elsewhere on the screen.
| Action | — | — |
ExpandAll()Opens every section. With MultipleOpen off, opens the first. | Action | — | — |
CollapseAll()Closes every section. | Action | — | — |
Guide
Use lcsAccordion for help text, FAQs, a long form split into named parts, or any screen where people want the headings first and the detail only when they ask for it. Canvas apps have no accordion; makers build one from a gallery and a visibility variable, and the row heights fight them. This component is that gallery done once:
- Sections from a table of
Key,TitleandBody; each row grows to fit its text, open or closed; - One open at a time (the default), or several with
MultipleOpen; OpenKeysandOpenCountoutputs, andOnToggle(Key, IsOpen)when a section changes;Toggle(Key),ExpandAll()andCollapseAll()actions, so a link or a search can open the right section;- Headers that are real buttons, named "expanded" or "collapsed" for screen readers, each section a rounded tile, the open one white with an edge and its chevron in a circle tinted in your colour.
The examples call it accHelp on a help screen.
Sections from your own table, kept in a collection so the text can live in a list or a Dataverse table:
// Screen.OnVisible
ClearCollect(colHelp, ShowColumns(SortByColumns(HelpTopics, "Order"), "Key", "Title", "Body"))
// accHelp.Items
colHelp
Open the section a search found:
// btnSearch.OnSelect
accHelp.CollapseAll();
accHelp.Toggle(LookUp(colHelp, StartsWith(Title, txtSearch.Value)).Key)
Open the first section when the screen loads:
// accHelp.DefaultOpenKeys
First(colHelp).Key
It's 400 pixels tall; set its Height on the screen to the room you have, and the sections scroll inside it. To fill the space down to the bottom of the screen:
// accHelp.Height
Parent.Height - accHelp.Y - 24
Remember which sections someone opened:
// accHelp.OnToggle
Patch(UserPrefs, varMyPrefs, {OpenHelp: accHelp.OpenKeys})
- Columns.
Itemswants exactlyKey,TitleandBody. From a Dataverse table,ShowColumnsandRenameColumnsto those names (use the logical names, such ascr123_title), as in Use it. - Multiline text columns come through as plain text with line breaks, which the body keeps; rich text (HTML) doesn't render, so store help text as plain text or strip the tags in a flow.
- Sorting a Dataverse table with
SortByColumnsdelegates; keep the collection small, because every row is rendered.
- Each header is a button named by its title plus "expanded" or "collapsed", so a screen reader hears the state; Enter and Space toggle it; Tab moves between headers (and through the open bodies' text).
- The open section is a white tile with an edge, and its chevron points up in a tinted circle; state is never colour alone.
- With
Motionon, the chevron's circle pops in as a section opens, in about a third of a second. None plays for people who've asked their device for reduced motion, andMotionoff draws it at once.
- The component doesn't grow as sections open: Studio can't size a component from what's inside it (it falls back to a default size), so it keeps the
Heightyou set and its sections scroll inside it. - Bodies are plain text (line breaks are kept); for links or formatting, put a control under the accordion that shows the open section's detail using
OpenKeys. - Row heights come from the flexible-height gallery: if a body shows cut off, the app's Studio version may lay the row out late; selecting the section again redraws it.
ExpandAllwithMultipleOpenoff opens only the first section, because only one can be open.
- 0.1.0: first version: sections from a table, one or several open,
OpenKeys,OpenCount,OnToggle,Toggle,ExpandAll,CollapseAll, light and dark, the underline motion.
Did it work for you?
No ratings yet.Nobody has said it worked in their app yet.
Sign in to rate it or to say it worked in your app.
Comments
No comments yet. Share how you used it, or ask something.
Sign in to comment or reply. Comments show under a display name you choose, never your email.