Develop ultra fast with Prismane 🎉

useThemeModeValue

useThemeModeValue hook simplifies the logic for using two style properties for dark and light modes.

Import

import { useThemeModeValue } from "@prismane/core";

Usage

function Demo() {
  const { toggleThemeMode } = usePrismaneTheme();

  const background = useThemeModeValue(["base", 300], ["base", 900]);

  return (
    <Center w="100%" h={fr(72)} bg={background}>
      <Button onClick={toggleThemeMode}>Toggle Theme Mode</Button>
    </Center>
  );
}

API

Return Value

NameTypeDescription
valueanyThe current active value.