Is there a way to "program" button web parts?

Copper Contributor

Hello. Essentially, I need a button, or some other mechanism, to send users to different lists depending on the user's name. I've accomplished this with a Power App embedded into the SharePoint page, where I used the Launch() function with a button. However, embedded Power Apps are clunky and don't necessarily fit into the theme of a SharePoint site, and I would much prefer if this was somehow possible with other web parts.


Is there a way to accomplish this? Thanks much.

2 Replies

@ameyer24 If your users can be “grouped” into Audiences, the easiest way to do this would be to use the Quick Links web part with a button layout and target each link to different audiences. That way, each user only sees the button that is relevant for them. 

best response confirmed by ameyer24 (Copper Contributor)

@ameyer24 Unfortunately, SharePoint does not provide any out of the box web part to write customized logic or JavaScript for such requirements.


Here is the list of web parts supported out of the box in SharePoint online modern experience: Using web parts on SharePoint pages


Here are some recommendations which might work for you (choose anyone depending on your conditional logic based on "user names"):

  1. When you embed Power Apps in SharePoint page, you have to provide the URL of application inside Power Apps web part settings. You can pass the query string parameters with the application URL which you can read in your Power Apps using Param function. You can either pass the color name or pass the SharePoint theme name and based on that you can change the colors in the application. Check default themes, colors and theme generator for more information: SharePoint site theming

  2. If you have to conditional logic based on "group" of users, you can use Quick links web part and audience targeting in SharePoint - you will need Azure AD or M365 groups for audience targetting.

  3. Try Modern Script editor web part using which you can add custom HTML, CSS and JS on SharePoint modern pages. You can write your own code to customize the display (color, background color, etc.) of buttons. For example: Current user context in SharePoint modern page

  4. Develop custom SPFx web part for showing buttons on the SharePoint modern pages. SPFx is Microsoft recommended custom web part development tool which gives you more flexibility and control over coding you can use to show the buttons on page. You can also customize the display based on currently set SharePoint site theme. Check:

Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.