Skip to content

Update server-side-rendering.md #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/guide/server-side-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,33 @@ const { isDark } = useCustomTheme()
</VApp>
</template>
```
## Vuetify Themes (useCookie)
Another alternative method to toggle dark and light theme is to use Vuetify [useTheme](https://vuetifyjs.com/en/api/use-theme/) and Nuxt 3 [useCookie]([https://vuetifyjs.com/en/api/use-theme/](https://nuxt.com/docs/api/composables/use-cookie)) together
```vue
<script setup>
const theme = useTheme()
// set cookie name
const darkmode = useCookie('darkmode')

// check if darkmode cookie has a value if none it will use the default theme on your vuetify options
if(darkmode.value){
theme.global.name.value = darkmode.value
}

// to change theme between dark and light mode
function toggleDarkmode () {
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark'
darkmode.value = theme.global.name.value
}
</script>

<template>
<!--Use this to toggle dark mode or light mode theme-->
<v-btn>
Toggle Dark Theme
</v-btn>
</template>
```

## Vuetify Display

Expand Down