mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
Merge branch 'main' of github.com:nextui-org/nextui into feat/new-lading-page
This commit is contained in:
commit
7b4a45dc63
2
apps/docs/content/docs/theme/dark-mode.mdx
vendored
2
apps/docs/content/docs/theme/dark-mode.mdx
vendored
@ -41,6 +41,7 @@ import { ThemeProvider as NextThemesProvider } from 'next-themes';
|
|||||||
// 2. Call `createTheme` and pass your custom values
|
// 2. Call `createTheme` and pass your custom values
|
||||||
const lightTheme = createTheme({
|
const lightTheme = createTheme({
|
||||||
type: 'light',
|
type: 'light',
|
||||||
|
className: 'light', // customize the class that enables this theme, `light-theme` by default
|
||||||
theme: {
|
theme: {
|
||||||
colors: {...},
|
colors: {...},
|
||||||
}
|
}
|
||||||
@ -48,6 +49,7 @@ const lightTheme = createTheme({
|
|||||||
|
|
||||||
const darkTheme = createTheme({
|
const darkTheme = createTheme({
|
||||||
type: 'dark',
|
type: 'dark',
|
||||||
|
className: 'dark', // customize the class that enables this theme, `dark-theme` by default
|
||||||
theme: {
|
theme: {
|
||||||
colors: {...},
|
colors: {...},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,11 +43,10 @@ npm i @nextui-org/react
|
|||||||
Go to the root of your application and do this:
|
Go to the root of your application and do this:
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
import { CssBaseline, NextUIProvider } from '@nextui-org/react';
|
import { NextUIProvider } from '@nextui-org/react';
|
||||||
|
|
||||||
const Application = () => (
|
const Application = () => (
|
||||||
<NextUIProvider>
|
<NextUIProvider>
|
||||||
<CssBaseline /> // ---> Normalize styles
|
|
||||||
<AppComponent /> // ---> Your App Component
|
<AppComponent /> // ---> Your App Component
|
||||||
</NextUIProvider>
|
</NextUIProvider>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -60,12 +60,12 @@ export const sharedVisuallyHidden = css({
|
|||||||
position: 'absolute'
|
position: 'absolute'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const createTheme = ({ type, theme }: Theme) => {
|
export const createTheme = ({ type, theme, className }: Theme) => {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
throw new Error('Theme type is required');
|
throw new Error('Theme type is required');
|
||||||
}
|
}
|
||||||
return createThemeBase(
|
return createThemeBase(
|
||||||
`${type}-theme`,
|
className || `${type}-theme`,
|
||||||
deepMerge(type === 'dark' ? darkTheme : lightTheme, theme)
|
deepMerge(type === 'dark' ? darkTheme : lightTheme, theme)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -47,6 +47,7 @@ export interface TokenValue {
|
|||||||
|
|
||||||
export type Theme = {
|
export type Theme = {
|
||||||
type?: ThemeType | string;
|
type?: ThemeType | string;
|
||||||
|
className?: string;
|
||||||
theme?: BaseTheme;
|
theme?: BaseTheme;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user