How to disable a ToggleButton?

UI Components for React
Post Reply
Master_T
Posts: 14
Joined: 13 Dec 2021, 11:57

13 Dec 2021, 12:02

Hello everyone

I have a ToggleButton that I want to disable (greyed-out, non clickable).
However, unlike the standard Button component, the ToggleButton doesn't have a disabled property, which means that something like this:

Code: Select all

<ToggleButton disabled={true}></ToggleButton>
will not compile.

Is there another way to disable a ToggleButton?

mcandu
Posts: 107
Joined: 20 Jan 2021, 16:31

14 Dec 2021, 13:29

Hi,

You can add p-disabled class to ToggleButton

Code: Select all

<ToggleButton className="p-disabled"/>
Best Regards,

Master_T
Posts: 14
Joined: 13 Dec 2021, 11:57

15 Dec 2021, 15:16

Thanks, it worked!

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests