Skip to content

How to Change Element Colours? #2614

Answered by whale2002
coofercat asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, there 👋
you can try the prop theme-overrides to override style, like this

<script>
import { NSwitch } from 'naive-ui'

export default {
  components: {
    NSwitch,
  },
  data() {
    return {
      switch: true,
      switchThemeOverrides: {
        railColor: '#FFFF00',
        railColorActive: '#0000FF'
      }
    }
  }
}
</script>
<template>
  <div class="example">
    <n-switch v-model:value="switch" :theme-overrides="switchThemeOverrides"/>
  </div>
</template>
<style>
.example {
  border: 5px solid white;
  padding: 20px;
}
</style>

The document: https://www.naiveui.com/en-US/light/docs/customize-theme#Customizing-component-theme-vars
The themes in Naive UI are customizable. …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@coofercat
Comment options

Answer selected by coofercat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants