Data Table
Enterprise data table and card gallery with dual view modes, configurable columns, context menus, status pills, priority badges, segmented progress bars, and full theme customization. Supports up to 8 dynamic columns with auto/fixed/percentage widths.
Import via Components → New component → Import from code
Preview
Installation
Copy the YAML component definition and import into Power Apps Studio.
# In Power Apps Studio:
1. Components → New component → Import from code
2. Paste YAML definition
3. Component appears in library
4. Configure Items, Columns, and theme propertiesUsage
Basic implementation
// Set data source
cmpDynamicGallery.Items: YourDataSource
cmpDynamicGallery.Width: Parent.Width
cmpDynamicGallery.Height: 600
// Define columns (supports up to 8)
cmpDynamicGallery.Columns: Table(
{Field: "Actions", Header: "Actions", Align: "Center",
Mode: "px", WidthPx: 50, AutoMinPx: 50, AutoMaxPx: 50},
{Field: "CaseID", Header: "Case ID", Align: "Left",
Mode: "px", WidthPx: 120, AutoMinPx: 100, AutoMaxPx: 150},
{Field: "Title", Header: "Title", Align: "Left",
Mode: "auto", WidthPx: 280, AutoMinPx: 220, AutoMaxPx: 360},
{Field: "Status", Header: "Status", Align: "Center",
Mode: "px", WidthPx: 120, AutoMinPx: 100, AutoMaxPx: 140}
)View mode toggle
// Enable view toggle between table and card
cmpDynamicGallery.ShowViewToggle: true
cmpDynamicGallery.ViewMode: "table" // Default: "table" or "card"
// React to view changes
cmpDynamicGallery.OnViewChange:
Notify(
"Switched to " & cmpDynamicGallery.SelectedViewMode & " view",
NotificationType.Information
)
// Read current view
Set(varCurrentView, cmpDynamicGallery.SelectedViewMode)Context menu with SVG icons
// Enable context menu
cmpDynamicGallery.EnableMenu: true
// Define menu items with SVG icons
cmpDynamicGallery.ContextMenuItems: Table(
{
ItemKey: "view",
ItemDisplayName: "View",
ItemIconSvg: "<svg ...>...</svg>",
ItemIconColor: "60,60,60,1",
ItemEnabled: true,
ItemVisible: true
},
{
ItemKey: "edit",
ItemDisplayName: "Edit",
ItemIconSvg: "<svg ...>...</svg>",
ItemIconColor: "60,60,60,1",
ItemEnabled: true,
ItemVisible: true
},
{
ItemKey: "delete",
ItemDisplayName: "Delete",
ItemIconSvg: "<svg ...>...</svg>",
ItemIconColor: "248,113,113,1",
ItemEnabled: true,
ItemVisible: true
}
)
// Handle menu selection
cmpDynamicGallery.OnMenuItemSelect:
Switch(
cmpDynamicGallery.SelectedMenuItem.ItemKey,
"view", Navigate(ViewScreen, None, {Item: cmpDynamicGallery.SelectedItem}),
"edit", Navigate(EditScreen, None, {Item: cmpDynamicGallery.SelectedItem}),
"delete", Remove(DataSource, cmpDynamicGallery.SelectedItem)
)Status & priority configuration
// Status pills (5 built-in statuses + default)
cmpDynamicGallery.StatusField: "Status"
cmpDynamicGallery.StatusConfig: {
pill: {radius: 20, paddingX: 16, paddingY: 6, fontSize: 11, fontWeight: "Semibold"},
inProgress: {background: "219,234,254,1", text: "30,64,175,1"},
completed: {background: "212,244,221,1", text: "15,81,50,1"},
onHold: {background: "254,243,199,1", text: "146,64,14,1"},
notStarted: {background: "243,244,246,1", text: "75,85,99,1"},
default: {background: "240,240,240,1", text: "96,96,96,1"}
}
// Priority badges (3 levels + default)
cmpDynamicGallery.PriorityConfig: {
high: {background: "254,226,226,1", text: "185,28,28,1"},
medium: {background: "254,243,199,1", text: "146,64,14,1"},
low: {background: "220,252,231,1", text: "22,101,52,1"},
default: {background: "243,244,246,1", text: "75,85,99,1"}
}Progress bar colors
// Segmented progress bar (SVG-based, up to 10 segments)
// Uses CompletedSteps and TotalSteps from your data
cmpDynamicGallery.ProgressActiveColor: "2563EB" // Blue hex without #
cmpDynamicGallery.ProgressInactiveColor: "E2E8F0" // Gray hex without #
// Your data should include:
// CompletedSteps: 3, TotalSteps: 5Theme customization
cmpDynamicGallery.ThemeConfig: {
container: {
background: "255,255,255,1",
border: "224,224,224,1",
borderThickness: 1,
radius: 12
},
header: {
background: "249,250,251,1",
border: "224,224,224,1",
borderThickness: 2,
textColor: "96,96,96,1",
fontSize: 11,
fontWeight: "Semibold",
height: 50
},
row: {
background: "0,0,0,0",
hoverBackground: "248,249,250,0.5",
borderColor: "240,240,240,1",
borderThickness: 1,
height: 60
},
card: {
background: "255,255,255,1",
border: "229,231,235,1",
borderThickness: 1,
radius: 12,
height: 280,
gap: 16
},
text: {
primary: "32,32,32,1",
secondary: "96,96,96,1",
accent: "37,99,235,1",
fontFamily: "Segoe UI",
fontSizeNormal: 12,
fontSizeSmall: 11,
fontWeightNormal: "Normal",
fontWeightBold: "Semibold"
},
spacing: {
paddingLeft: 20,
paddingTop: 16,
columnGap: 10
}
}Properties
Input Properties
| Property | Type | Default | Description |
|---|---|---|---|
Items | Table | Sample data | Data source for the gallery. Must include fields matching column definitions. |
Columns | Table | 8-column layout | Column definitions with Field, Header, Align, Mode, WidthPx, AutoMinPx, AutoMaxPx. |
ViewMode | Text | "table" | Initial view mode: "table" or "card". |
ShowViewToggle | Boolean | true | Show the table/card view toggle buttons. |
ShowHeader | Boolean | true | Show column headers in table view. |
EnableMenu | Boolean | true | Enable context menu (⋮) button on rows. |
EnableHover | Boolean | true | Enable row hover highlight effects. |
ContextMenuItems | Table | View, Edit, Delete | Menu items with ItemKey, ItemDisplayName, ItemIconSvg, ItemIconColor, ItemEnabled, ItemVisible. |
MenuConfig | Record | Default styling | Context menu visual config: icon size/color, container bg/border/radius, item colors/heights. |
StatusField | Text | "Status" | Which data field maps to status pills. |
StatusConfig | Record | 5 statuses | Colors for: inProgress, completed, onHold, notStarted, default. Includes pill styling. |
PriorityConfig | Record | 3 priorities | Colors for: high, medium, low, default priority badges. |
ProgressActiveColor | Text | "2563EB" | Hex color (without #) for completed progress segments. |
ProgressInactiveColor | Text | "E2E8F0" | Hex color (without #) for incomplete progress segments. |
ThemeConfig | Record | Light theme | Full theme: container, header, row, card, text, and spacing configuration. |
Output Properties
| Property | Type | Description |
|---|---|---|
SelectedItem | Record | Currently selected row/card data record. |
SelectedMenuItem | Record | The last selected context menu item (ItemKey, ItemDisplayName, etc.). |
SelectedViewMode | Text | Current active view mode ("table" or "card"). |
ColContext | Record | Computed column layout: Cols table, TotalWidth, Gap, PadL. |
Events
| Event | Description |
|---|---|
OnRowSelect | Fires when a row or card is tapped. SelectedItem is populated before this fires. |
OnMenuItemSelect | Fires when a context menu item is chosen. SelectedMenuItem and SelectedItem both populated. |
OnViewChange | Fires when the user toggles between table and card views. |
Implementation
Column system
Supports up to 8 columns with three width modes: px (fixed width),auto (flexible between AutoMinPx and AutoMaxPx). Each column definition includes Field, Header, Align (Left/Center/Right), Mode, WidthPx, AutoMinPx, and AutoMaxPx. The computed ColContext output provides total width for horizontal scroll.
Dual view modes
Table view renders rows in a horizontal auto-layout gallery with configurable header. Card view renders responsive cards using WrapCount (1 column under 600px, 2 under 1024px, 3 above). Both views share the same data source and support context menus.
Context menus
Built with the TabList modern control for reliable flyout behavior. Menu items support custom SVG icons, RGBA color strings, and individual enabled/visible flags. The delete action uses a distinct red color (ItemIconColor: "248,113,113,1").
Progress bars
Segmented SVG progress bars render dynamically based on CompletedSteps and TotalSteps fields. Supports up to 10 segments. Colors are customizable via ProgressActiveColor and ProgressInactiveColor (hex without #). Both table rows and cards render identical progress visuals.
Color system
All colors use RGBA string format ("R,G,B,A") parsed at runtime with Split() and Value(). This enables full customization through input properties without modifying the component internals.
Row selection
Table rows use an invisible button overlay for tap detection. The overlay starts after the actions column to prevent interfering with the context menu. On select, varDG_SelectedItem and varDG_MenuRowItem are both set, then OnRowSelect fires.
Examples
Context menu actions
OnMenuItemSelect:
Switch(
Self.SelectedMenuItem.ItemKey,
"view",
Navigate(DetailScreen, None, {
Record: Self.SelectedItem
}),
"edit",
Set(varEditMode, true);
Set(varEditRecord, Self.SelectedItem),
"delete",
Remove(DataSource, Self.SelectedItem)
)Status pills & priority badges
Status
Priority
Progress
// Built-in status matching
// Uses Lower() + Switch() pattern
Switch(
Lower(Text(ThisItem.Status)),
"in progress", InProgressColors,
"completed", CompletedColors,
"on hold", OnHoldColors,
"not started", NotStartedColors,
DefaultColors
)
// Priority uses same pattern
Switch(
Lower(Text(ThisItem.Priority)),
"high", HighColors,
"medium", MediumColors,
"low", LowColors,
DefaultColors
)
// Progress reads from data fields:
// ThisItem.CompletedSteps
// ThisItem.TotalStepsFull 8-column definition
Columns: Table(
{Field: "Actions", Header: "Actions", Align: "Center", Mode: "px", WidthPx: 50, AutoMinPx: 50, AutoMaxPx: 50},
{Field: "CaseID", Header: "Case ID", Align: "Left", Mode: "px", WidthPx: 120, AutoMinPx: 100, AutoMaxPx: 150},
{Field: "Title", Header: "Title", Align: "Left", Mode: "auto", WidthPx: 280, AutoMinPx: 220, AutoMaxPx: 360},
{Field: "Status", Header: "Status", Align: "Center", Mode: "px", WidthPx: 120, AutoMinPx: 100, AutoMaxPx: 140},
{Field: "Progress", Header: "Progress", Align: "Left", Mode: "px", WidthPx: 180, AutoMinPx: 150, AutoMaxPx: 200},
{Field: "Assignee", Header: "Assignee", Align: "Left", Mode: "auto", WidthPx: 150, AutoMinPx: 120, AutoMaxPx: 180},
{Field: "DueDate", Header: "Due Date", Align: "Left", Mode: "px", WidthPx: 120, AutoMinPx: 100, AutoMaxPx: 140},
{Field: "Priority", Header: "Priority", Align: "Center", Mode: "px", WidthPx: 100, AutoMinPx: 80, AutoMaxPx: 120}
)
// ColContext output will compute TotalWidth for scroll container