Modern commanding in Power Apps now supports Power Fx for both visibility and actions. Unlike classic commands (formerly known as ribbons), which required custom code and were difficult to manage, modern commands are simpler and more flexible.

To configure button visibility using Power Fx, first navigate to your solution and edit the Model-driven app.

add command from model driven app

Note

Adding the command from the table designer won’t enable the Show on condition from formula option. You must add the command from the model-driven app editor which will also link it to the table.

Now select any existing button or add a new one from the top.

In the right-hand panel, under Visibility, select Show on condition from formula and click Open formula bar.

visible option form button

It will open the Power Fx editor at the top.

power fx editor for the command

To access the current record context, use Self.Selected.Item.

For example, to display the Approve button only when the timesheet status is ‘Submitted’, use the following Power Fx formula –

If(
  Self.Selected.Item.'Status Reason' = 'Status Reason (Timesheets)'.Submitted, 
  true,
  false
)

This will dynamically show or hide the button based on the current record’s status.

Explore the official documentation for a full list of supported Power Fx functions and advanced usage examples.