

Tango UI provides a simple and efficient theme switching feature, supporting dynamic switching between light and dark themes. Through the built-in ThemeProvider and useTheme Hook, you can easily implement theme management for your application.
All Tango UI components can directly support theme switching. If you want other elements to also support theme colors, you must use the Space component.
Name | Age | Gender | Math Score | English Score | Address |
|---|---|---|---|---|---|
Brown | 32 | Male | 80 | 87 | New York No. 1 Lake Park |
John Doe | 42 | Female | 60 | 105 | Shanghai Pudong New District First Lake Park |
John Smith | 45 | Male | 75 | 90 | Guangzhou Tianhe District First Lake Park |
import { ThemeProvider } from "tango-ui-cw";
function Root() {
return (
<ThemeProvider>
<App />
</ThemeProvider>
);
}import { useTheme } from "tango-ui-cw";
function ThemeSwitch() {
const { toggleTheme } = useTheme();
return (
<button onClick={toggleTheme}>
Switch Theme
</button>
);
}const { theme, toggleTheme, setTheme } = useTheme();Prop | Type | Accepted Values | Description | Default |
|---|---|---|---|---|
theme | string | light | dark | specify the current theme,two themes are supported: 'light' and 'dark'. | light |
toggleTheme | function | () => void | a function used to switch themes. | - |
setTheme | function | (theme: 'light' | 'dark') => void | a function used to set the theme. | - |