diff --git a/README.md b/README.md index 072337e9e..f414b81a2 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,9 @@ GITS UI is the official UI Component Library in GITS Indonesia built with Vue 3 - 🚀 Provides [TypeScript](https://www.typescriptlang.org/) support by default - 🎨 Allows for customization with CSS properties - 🔌 Modular design: allows for use as a complete UI framework or as individual plugins -- 🏷 Headless by default -- 🌈 Theming support (coming soon) +- 🏷 Headless component by default +- 🎨 Dark mode: ships with dark mode styles out-of-the-box +- 🌈 Theming support: create your own custom theme easily ## Documentation diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js index bced108b9..770fdbadc 100644 --- a/docs/.vitepress/config.js +++ b/docs/.vitepress/config.js @@ -28,6 +28,7 @@ export default defineConfig({ {text: 'Getting Started', link: '/guide/getting-started'}, {text: 'Customization', link: '/guide/customization'}, {text: 'Default Theme', link: '/guide/theme'}, + {text: 'Dark Mode', link: '/guide/dark-mode'}, {text: 'Starter', link: '/guide/starter'}, {text: 'Migration', link: '/guide/migration'}, {text: 'Changelog', link: '/guide/changelog'}, diff --git a/docs/guide/dark-mode.md b/docs/guide/dark-mode.md new file mode 100644 index 000000000..65c4685da --- /dev/null +++ b/docs/guide/dark-mode.md @@ -0,0 +1,74 @@ +# Dark Mode + +The GITS UI includes dark mode support by default, however, to enable it, you will need to load the styles explicitly. + +## Tailwind Configuration + +To enable dark mode, you need to set the `darkMode` option to `class` in your Tailwind config file. + +```ts {2} +module.exports = { + darkMode: 'class', +}; +``` + +## Enabling Dark Mode on a Vue App + +To enable dark mode on a Vue application, load the dark mode styles in your `main.ts` file. + +```ts {10} +import {createApp} from 'vue'; +import {createPinia} from 'pinia'; +import App from './App.vue'; +import router from './router'; +import GitsUi from '@gits-id/ui'; +import './assets/index.css'; +import '@gits-id/ui/styles.scss'; + +// load dark mode styles +import '@gits-id/ui/styles.dark'; + +const app = createApp(App); + +app.use(createPinia()); +app.use(router); +app.use(GitsUi); + +app.mount('#app'); +``` + +## Enabling Dark Mode on a Nuxt App + +To enable dark mode on a Nuxt application, set the value of `darkMode` option to `true` in your `nuxt.config.ts` file. + +```ts {4} +export default defineNuxtConfig({ + modules: ['@gits-id/ui-nuxt', '@nuxtjs/tailwindcss'], + gitsUi: { + darkMode: true, + }, +}); +``` + +## Toggling between dark and light mode + +You can toggle between `dark` and `light` mode by toggling the `class` of the parent element between `dark` or `light`. For example, you can set the value of the `html` class to `dark` to enable dark mode and `light` to enable light mode. + +```vue + + + +``` diff --git a/docs/index.md b/docs/index.md index d977ae7dd..7118b9906 100644 --- a/docs/index.md +++ b/docs/index.md @@ -37,5 +37,8 @@ features: details: GITS UI comes with TypeScript support out-of-the-box. - icon: 🎨 title: Themes - details: GITS UI includes support for theming (soon). + details: GITS UI includes support for theming. + - icon: 🎨 + title: Dark Mode + details: Support dark mode out-of-the-box. --- diff --git a/packages/alert/README.md b/packages/alert/README.md index cddd184cf..ee319c469 100644 --- a/packages/alert/README.md +++ b/packages/alert/README.md @@ -6,18 +6,20 @@ GITS Alert component is a flexible alert component that can be used to display v Install with your prefered package manager. - With NPM: + ``` npm i @gits-id/alert ``` With Yarn: + ``` yarn add @gits-id/alert ``` With PNPM: + ``` pnpm i @gits-id/alert ``` @@ -30,8 +32,13 @@ To use the component, you can simply include it in your template like this: