This is a migrated thread and some comments may be shown as answers.

Dynamic themes from DB?

2 Answers 155 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 14 Apr 2021, 07:26 PM

Hey everyone,

I'm considering KenoReact for some upcoming projects. It looks like an excellent component library.

I have one question regarding themes. Judging by the documentation it appears that themes can only be customized by overwriting SCSS variables directly within the SCSS file before the theme is imported. Theme customization in general appears somewhat limited in that there doesn't seem to be any way to programmatically override the theme.

For instance, if I wanted to allow a client to pick their own theme colours via a colour picker, save the colours to DB and then use those values in the theme I don't see any clear way to do this. For instance this type of implementation would be possible with Material-UI theming. One possibility is to use the styled components integration to override the theme? Though I imagine this might be somewhat cumbersome.

Any insight would be appreciated, thank you!

2 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 14 Apr 2021, 07:46 PM
Maybe a better way to ask this is, would it be possible to update the theme in the client from application state?
0
Stefan
Telerik team
answered on 15 Apr 2021, 09:12 AM

Hello, Kevin,

The components can also be customized directly with CSS using the class selectors. This can be done by dynamically inserting CSS into the page.

Another option is the use styled components like in this demo:

https://www.telerik.com/kendo-react-ui/components/styling/styled-components/

The styled component can also be made dynamic to control the values based on an end-user selection:

https://stackblitz.com/edit/react-gjjqct?file=app/main.jsx

If more specific details are needed, please let me know.

 

Regards,
Stefan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
General Discussions
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or