How can I apply changes to the toolbarTemplate?

Hi,

I'm managing the active state of buttons within the toolbarTemplate using useState, but changes to the state aren't reflected on the screen.

Is there a way to resolve this?

Sample:https://stackblitz.com/edit/react-jvfimn8r?file=App.js


7 Replies

KM Kishore Muthukrishnan Syncfusion Team October 7, 2025 05:08 AM UTC

Hi ,


Greetings from Syncfusion support,


To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.


const click = () => { 

    const newState = !buttonDisable;

    setButtonDisable(newState);

    if (buttonRef.current) {

      buttonRef.current.disabled = newState;

    }

  };
 

 <ButtonComponent

          id="addButton"

          ref={buttonRef}

          cssClass="e-outline"

          disabled={buttonDisable}

        >

          test

        </ButtonComponent>


Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
 

Regards,

Kishore Muthukrishnan



KM Kishore Muthukrishnan Syncfusion Team October 7, 2025 05:08 AM UTC

Hi ,


Greetings from Syncfusion support,


To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.


const click = () => { 

    const newState = !buttonDisable;

    setButtonDisable(newState);

    if (buttonRef.current) {

      buttonRef.current.disabled = newState;

    }

  };
 

 <ButtonComponent

          id="addButton"

          ref={buttonRef}

          cssClass="e-outline"

          disabled={buttonDisable}

        >

          test

        </ButtonComponent>


Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
 

Regards,

Kishore Muthukrishnan



KM Kishore Muthukrishnan Syncfusion Team October 7, 2025 05:08 AM UTC

Hi ,


Greetings from Syncfusion support,


To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.


const click = () => { 

    const newState = !buttonDisable;

    setButtonDisable(newState);

    if (buttonRef.current) {

      buttonRef.current.disabled = newState;

    }

  };
 

 <ButtonComponent

          id="addButton"

          ref={buttonRef}

          cssClass="e-outline"

          disabled={buttonDisable}

        >

          test

        </ButtonComponent>


Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
 

Regards,

Kishore Muthukrishnan



KM Kishore Muthukrishnan Syncfusion Team October 7, 2025 05:08 AM UTC

Hi ,


Greetings from Syncfusion support,


To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.


const click = () => { 

    const newState = !buttonDisable;

    setButtonDisable(newState);

    if (buttonRef.current) {

      buttonRef.current.disabled = newState;

    }

  };
 

 <ButtonComponent

          id="addButton"

          ref={buttonRef}

          cssClass="e-outline"

          disabled={buttonDisable}

        >

          test

        </ButtonComponent>


Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
 

Regards,

Kishore Muthukrishnan



KM Kishore Muthukrishnan Syncfusion Team October 7, 2025 05:08 AM UTC

Hi ,


Greetings from Syncfusion support,


To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.


const click = () => { 

    const newState = !buttonDisable;

    setButtonDisable(newState);

    if (buttonRef.current) {

      buttonRef.current.disabled = newState;

    }

  };
 

 <ButtonComponent

          id="addButton"

          ref={buttonRef}

          cssClass="e-outline"

          disabled={buttonDisable}

        >

          test

        </ButtonComponent>


Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
 

Regards,

Kishore Muthukrishnan



KM Kishore Muthukrishnan Syncfusion Team October 7, 2025 05:08 AM UTC

Hi ,


Greetings from Syncfusion support,


To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.


const click = () => { 

    const newState = !buttonDisable;

    setButtonDisable(newState);

    if (buttonRef.current) {

      buttonRef.current.disabled = newState;

    }

  };
 

 <ButtonComponent

          id="addButton"

          ref={buttonRef}

          cssClass="e-outline"

          disabled={buttonDisable}

        >

          test

        </ButtonComponent>


Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
 

Regards,

Kishore Muthukrishnan



KM Kishore Muthukrishnan Syncfusion Team October 7, 2025 05:08 AM UTC

Hi ,


Greetings from Syncfusion support,


To Achieve your requirement “dynamically enable/disable the toolbar buttons” , set the changed state to the disabled property using its reference. This ensures that the button inside the toolbar reflects the updated state.


const click = () => { 

    const newState = !buttonDisable;

    setButtonDisable(newState);

    if (buttonRef.current) {

      buttonRef.current.disabled = newState;

    }

  };
 

 <ButtonComponent

          id="addButton"

          ref={buttonRef}

          cssClass="e-outline"

          disabled={buttonDisable}

        >

          test

        </ButtonComponent>


Sample : https://stackblitz.com/edit/react-jvfimn8r-sjzkvduh?file=App.js
 

Regards,

Kishore Muthukrishnan


Loader.
Up arrow icon