Unable to use Header in ThemedLayoutV2
I'm following the instructions here https://refine.dev/docs/api-reference/antd/theming/#switching-to-dark-theme
and I get this error:
Theme | refine
Ant Design allows you to customize design tokens to satisfy UI diversity from business or brand requirements, including primary color, border radius, border color, etc.
3 Replies
Hi @geoffatsource. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The error message you're seeing is due to TypeScript's strict type checking. It's saying that the
Header
component you're trying to use as a prop in ThemedLayoutV2
is expecting props of type HeaderProps
, but you're not providing any.
The Header
component is defined with HeaderProps
which expects two props: theme
and setTheme
. Here's the definition of HeaderProps
and Header
from the documentation (https://refine.dev/docs/api-reference/antd/theming/#switching-to-dark-theme):
When you use Header
in ThemedLayoutV2
, you need to provide these props. Here's how you can do it:
In this code, we're passing a function that returns the Header
component with the required props to ThemedLayoutV2
. This should resolve the TypeScript error you're seeing.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1014305963219615754> kapa.ai is still learning and improving, please let us know how it did by reacting below
deep-jade•12mo ago
okay the docs are incorrect though