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 / Create 3-State Button
Power Apps
Answered

Create 3-State Button

(0) ShareShare
ReportReport
Posted on by 30

How can I build a 3-state button?
 
First State: BLANK (Never Clicked)
Second State: X
Third State: O
 
Then cycle between X and O on subsequent clicks?

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Here's what I did to give the perception of more than 1 state button.

     

    For your scenario, we can do 3 states by utilizing visible field

     

     Set button 1 Visible field to variableX=0, button 2 to variableX=1, and variableX=2.

     

    Button 1 OnSelect field with UpdateContext({variableX:1})

    Button 2 OnSelect field with UpdateContext({variableX:2})

    Button 3 OnSelect field with UpdateContext({variableX:1})

     

    Hope this helps

  • Verified answer
    Paul_C Profile Picture
    Microsoft Employee on at

    If you want to do it with one button, try:

     

    Button1.OnSelect:

    UpdateContext({ Button1State: Mod(Button1State, 2) + 1 })

    Button1.Text:

    If(Button1State < 1, "", Button1State = 1, "X", "O")

     

    Are you building a tic-tac-toe game?

  • SqueezeOJ Profile Picture
    30 on at

    Hi Paul,

     

    Thanks for your response.  It worked perfectly!

     

    Yes, I'm trying to build a Tic-Tac-Toe game.  I'm very new to PowerApps and so I'm working through some CS101-type projects to see how it works. 

     

     

    Your 3-state button works great. However, I'm still trying to figure out a few more things, so I'll post them to another thread.

     

    Be well, Jason

  • SqueezeOJ Profile Picture
    30 on at

    Hi DXiong,

     

    Thanks for your solution.  It's an interesting adaptation that I might try if I can't get the logic for a true 3-state button to work.

     

    Be well, Jason

  • SqueezeOJ Profile Picture
    30 on at

    ResetButton.onSelect:

    UpdateContext({button1state:0})

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard