web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Expand Button size fro...
Power Apps
Answered

Expand Button size from center

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

I got a button to have a variable width dependent on clicking two other buttons. However, the width expands from the right side (as shown in GIF below). Is there a way to make it expand from the center (both left and right side move in and out)?

ezgif.com-video-to-gif.gif

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Sure, set the X property of your button to the following:

    (App.Width/2) - (Self.Width/2)

    I hope this is helpful for you. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes  Worked perfect! Thanks

  • Maxwell123 Profile Picture
    93 on at

    I Think I see what you are getting at. I do not know of any native way to get that done but Ive built a solution that I think does the job. 


    On your "X" icon set it to:

    Set(Expand,false)

     

    On your "+" icon set it to

    Set(Expand,true)

     

    Create a button with the size that you want it to be when expanded. (This will essentially be a dummy button) Lets call it Button1

     

    Set Button1's visibility to:

    If(Expand=true,true,false)

    So now if you click the plus button it will show up if you click the x button it will disapear. 

     

    Now add another button thats the size you would like it to be shrunk and place it in the center Button1 

     

    Set its visibility to:

    If(Expand=true,false,true)

     

    Now you should be all set.

     

    Screen Shot 2020-09-30 at 1.42.12 PM.png

     

    Screen Shot 2020-09-30 at 1.42.17 PM.png

     

    Here is what it will look like when clicked. 

    Let me know if that helps

     

  • Maxwell123 Profile Picture
    93 on at

    Shoot just saw this was already solved

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Maxwell123 

    Keep It Super Simple!!

     

    1 Icon

    Icon OnSelect Action: UpdateContext({lclExpand:!lclExpand})

    Icon Icon property: If(lclExpand, Icon.CollapseView, Icon.ExpandView)

     

    1 Button

    Button Width property: If(lclExpand, 400, 200)

    Button X property: (App.Width/2) - (Self.Width/2)

    Expander.gif

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard