Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to conditional colour a tab button #339

Open
mattspeller opened this issue Oct 4, 2022 · 5 comments
Open

How to conditional colour a tab button #339

mattspeller opened this issue Oct 4, 2022 · 5 comments

Comments

@mattspeller
Copy link

Is it possible to apply a classname programmatically to the tabnode so that the tab button (header) updates based on the classname provided. We have cases where data could be in error after initial render and want to update the colouring.
I am assuming it is something using updateModelAttributes but I can't find anything in discussions or documentation to perform something like the below:

node.getModel().doAction(
Actions.updateModelAttributes({ className: 'someRedClass' })
);

@eric-ho-github
Copy link

onRenderTab and onRenderTabSet will do the job for you

@mattspeller
Copy link
Author

mattspeller commented Dec 22, 2022 via email

@eric-ho-github
Copy link

@mattspeller you can use

import { Actions } from 'flexlayout-react';
...

            layoutModel.doAction(
              Actions.updateNodeAttributes(
                'node-id',
                {
                  className: 'new-css-class-name',
                }
              ),
            )

@eric-ho-github
Copy link

12-22-2022 (18-39-01)

@mattspeller
Copy link
Author

mattspeller commented Dec 22, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants