The ColorModeSwitch component extends the Switch component, so you can pass any property such as color, size, etc.
<template>
<UColorModeSwitch />
</template>
Use the app.config.ts to customize the icon with the ui.icons property:
export default defineAppConfig({
ui: {
icons: {
light: 'i-ph-sun',
dark: 'i-ph-moon'
}
}
})
Use the vite.config.ts to customize the icon with the ui.icons property:
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
ui: {
icons: {
light: 'i-ph-sun',
dark: 'i-ph-moon'
}
}
})
]
})
| Prop | Default | Type |
|---|---|---|
as |
|
The element or component this component should render as. |
color |
|
|
name |
The name of the field. Submitted with its owning form as part of a name/value pair. | |
loading |
When | |
size |
|
|
autofocus | ||
disabled |
When | |
form |
| |
formaction |
| |
formenctype |
| |
formmethod |
| |
formnovalidate |
| |
formtarget |
| |
value |
The value given as data when submitted with a | |
label |
| |
loadingIcon |
|
The icon when the |
defaultValue |
The state of the switch when it is initially rendered. Use when you do not need to control its state. | |
required |
When | |
id |
| |
description |
| |
ui |
|
5cb65 — feat: import @nuxt/ui-pro components