Usage
The ColorModeSwitch component extends the Switch component, so you can pass any property such as color, size, etc.
<template>
<PColorModeSwitch />
</template>
Examples
With custom icons
Use the app.config.ts to customize the icon with the pohon.icons property:
export default defineAppConfig({
pohon: {
icons: {
light: 'i-ph:sun',
dark: 'i-ph:moon'
}
}
})
Use the vite.config.ts to customize the icon with the pohon.icons property:
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import pohon from 'pohon-ui/vite'
export default defineConfig({
plugins: [
vue(),
pohon({
pohon: {
icons: {
light: 'i-ph:sun',
dark: 'i-ph:moon'
}
}
})
]
})
API
Props
| Prop | Default | Type |
|---|---|---|
as | 'div' | anyThe element or component this component should render as. |
color | 'primary' | "primary" | "secondary" | "success" | "info" | "warning" | "error" | "neutral" |
name | stringThe name of the field. Submitted with its owning form as part of a name/value pair. | |
loading | boolean When | |
size | 'md' | "md" | "xs" | "sm" | "lg" | "xl" |
autofocus | false | true | "true" | "false" | |
disabled | boolean When | |
label | string | |
loadingIcon | appConfig.pohon.icons.loading | string | objectThe icon when the |
defaultValue | boolean The state of the switch when it is initially rendered. Use when you do not need to control its state. | |
required | boolean When | |
id | string | |
value | stringThe value given as data when submitted with a | |
description | string | |
pohon | { root?: ClassValue; base?: ClassValue; container?: ClassValue; thumb?: ClassValue; icon?: ClassValue; wrapper?: ClassValue; label?: ClassValue; description?: ClassValue; } |