Documents
use-theme.en-US
use-theme.en-US
Type
External
Status
Published
Created
Jun 12, 2026
Updated
Jun 12, 2026
Source
View

Introduction#

When used in conjunction with container components (ThemeProvider), it can obtain the theme information under the container. If ThemeProvider is not added, the default value is obtained.

When useTheme is used under the ThemeProvider component, the theme value in the ThemeProvider can be obtained.

Usage#

import { useTheme } from 'antd-style';

function Theme() {
  const theme = useTheme();

  useEffect(() => {
    console.log(theme);
  }, [theme]);

  return null;
}

Typescript#

useTheme = () => Theme;

Return Value#

ParameterDescriptionTypeDefault
themeModeTheme modedark / light / autolight
appearanceDisplaydark / lightlight
isDarkModeDark modebooleanfalse
use-theme.en-US | Dosu