@mantine/colors-generator Usage with NextJS Server Components #7518
creativeindustriesgroup
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Request to Make
generateColors()
Usable in Server ComponentsHello Mantine Team,
I am building a multi-tenant application using Next.js (App Router) and Mantine UI. According to the documentation, all Mantine components rely on React Context, making them incompatible with Server Components. This makes sense for most cases. However, I believe that certain utility functions, such as
generateColors()
, do not require the'use client';
directive and could be made available for Server Components.Use Case & Issue
In my project, I need to dynamically configure the Mantine theme based on tenant-specific settings stored in a database. This setup requires fetching tenant data at the root level and defining the theme accordingly.
Example Code:
The Problem:
generateColors()
is currently marked with'use client';
, making it unusable in a Server Component.generateColors()
does not rely on React Context or client-side state.@mantine/colors-generator
library itself appears to be Server Component-compatible, but this restriction forces unnecessary workarounds.Request
Would it be possible to remove the
'use client';
directive from utility functions likegenerateColors()
(or move them into a separate, server-compatible package)? This change would allow developers to use these functions in Server Components without unnecessary workarounds.Let me know your thoughts, and thanks for all your work on Mantine! 🚀
Beta Was this translation helpful? Give feedback.
All reactions