2024-04-01 12:55:29 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<p>Design tokens can be scoped to a certain component using CSS variables. In this example, first switch uses the global tokens whereas second one overrides the global with its own tokens.</p>
|
|
|
|
</DocSectionText>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center gap-4">
|
2024-04-18 14:22:30 +00:00
|
|
|
<ToggleSwitch v-model="checked1" />
|
|
|
|
<ToggleSwitch v-model="checked2" :dt="amberSwitch" />
|
2024-04-01 12:55:29 +00:00
|
|
|
</div>
|
2024-09-24 07:32:12 +00:00
|
|
|
<DocSectionCode :code="code1" hideToggleCode hideStackBlitz />
|
2024-04-01 12:55:29 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
checked1: true,
|
|
|
|
checked2: true,
|
|
|
|
amberSwitch: {
|
|
|
|
handle: {
|
|
|
|
borderRadius: '4px'
|
|
|
|
},
|
|
|
|
colorScheme: {
|
|
|
|
light: {
|
|
|
|
root: {
|
|
|
|
checkedBackground: '{amber.500}',
|
|
|
|
checkedHoverBackground: '{amber.600}',
|
|
|
|
borderRadius: '4px'
|
|
|
|
},
|
|
|
|
handle: {
|
2024-04-01 13:15:14 +00:00
|
|
|
checkedBackground: '{amber.50}',
|
|
|
|
checkedHoverBackground: '{amber.100}'
|
2024-04-01 12:55:29 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
dark: {
|
|
|
|
root: {
|
|
|
|
checkedBackground: '{amber.400}',
|
|
|
|
checkedHoverBackground: '{amber.300}',
|
|
|
|
borderRadius: '4px'
|
|
|
|
},
|
|
|
|
handle: {
|
2024-04-01 13:15:14 +00:00
|
|
|
checkedBackground: '{amber.900}',
|
|
|
|
checkedHoverBackground: '{amber.800}'
|
2024-04-01 12:55:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
code1: {
|
|
|
|
basic: `
|
|
|
|
<template>
|
|
|
|
<div>
|
2024-04-18 14:22:30 +00:00
|
|
|
<ToggleSwitch v-model="checked1" />
|
|
|
|
<ToggleSwitch v-model="checked2" :dt="amberSwitch" />
|
2024-04-01 12:55:29 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
|
|
const checked1 = ref(true);
|
|
|
|
const checked2 = ref(true);
|
|
|
|
const amberSwitch = ref({
|
|
|
|
handle: {
|
|
|
|
borderRadius: '4px'
|
|
|
|
},
|
|
|
|
colorScheme: {
|
|
|
|
light: {
|
|
|
|
root: {
|
|
|
|
checkedBackground: '{amber.500}',
|
|
|
|
checkedHoverBackground: '{amber.600}',
|
|
|
|
borderRadius: '4px'
|
|
|
|
},
|
|
|
|
handle: {
|
2024-04-01 13:15:14 +00:00
|
|
|
checkedBackground: '{amber.50}',
|
|
|
|
checkedHoverBackground: '{amber.100}'
|
2024-04-01 12:55:29 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
dark: {
|
|
|
|
root: {
|
|
|
|
checkedBackground: '{amber.400}',
|
|
|
|
checkedHoverBackground: '{amber.300}',
|
|
|
|
borderRadius: '4px'
|
|
|
|
},
|
|
|
|
handle: {
|
2024-04-01 13:15:14 +00:00
|
|
|
checkedBackground: '{amber.900}',
|
|
|
|
checkedHoverBackground: '{amber.800}'
|
2024-04-01 12:55:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
<\/script>
|
|
|
|
|
|
|
|
`
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|