Button component to toggle between dark and light modes and change the icon accordingly.useMantineColorScheme**Source** (<https://refine.dev/docs/ui-integrations/ant-design/theming/#switching-to-dark-theme>)
### Chakra UI
In Chakra UI, you can use the `useColorMode` hook to toggle between dark and light modes and change the icon accordingly.**Source** (<https://refine.dev/docs/ui-integrations/chakra-ui/theming/#theme-switching>)
### Material UI
In Material UI, you can use a context to manage the color mode and toggle between dark and light modes, changing the icon accordingly.@ant-design/plots@ant-design/plotsimport { ActionIcon, MantineHeader, Group } from "@mantine/core";
import { IconSun, IconMoonStars } from "@tabler/icons-react";
import { useMantineColorScheme } from "@mantine/core";
const Header = () => {
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
const dark = colorScheme === "dark";
return (
<MantineHeader height={50} p="xs">
<Group position="right">
<ActionIcon
variant="outline"
color={dark ? "yellow" : "primary"}
onClick={() => toggleColorScheme()}
title="Toggle color scheme"
>
{dark ? <IconSun /> : <IconMoonStars />}
</ActionIcon>
</Group>
</MantineHeader>
);
};npm install @ant-design/plotsyarn add @ant-design/plotsnpm install @ant-design/charts