* Toggles!

* Toggle component

* Ran prettier
This commit is contained in:
Adrian O.V 2023-03-24 15:15:55 -04:00 committed by GitHub
parent 4ae7786362
commit f97c94832a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 0 deletions

View File

@ -36,6 +36,7 @@ export default {
{ text: 'Slider', link: '/components/slider' },
{ text: 'Text Inputs', link: '/components/text-inputs' },
{ text: 'Search Filter', link: '/components/search-filter' },
{ text: 'Toggle', link: '/components/toggle' },
],
},
],

20
docs/components/toggle.md Normal file
View File

@ -0,0 +1,20 @@
# Toggle
<script setup>
import { ref } from "vue";
const value = ref(true)
</script>
<DemoContainer>
<Toggle v-model="value" checked="true" />
</DemoContainer>
```vue
<script setup>
import { ref } from "vue";
const value = ref(true)
</script>
<Toggle v-model="value" />
```

View File

@ -0,0 +1,37 @@
<template>
<input
:id="id"
type="checkbox"
class="switch stylized-toggle"
:checked="checked"
@change="toggle"
/>
</template>
<script>
export default {
props: {
id: {
type: String,
required: true,
},
modelValue: {
type: Boolean,
},
checked: {
type: Boolean,
required: true,
},
},
emits: ['update:modelValue'],
methods: {
toggle() {
if (!this.disabled) {
this.$emit('update:modelValue', !this.modelValue)
}
},
},
}
</script>
<style scoped></style>

View File

@ -16,6 +16,7 @@ export { default as EnvironmentIndicator } from './base/EnvironmentIndicator.vue
export { default as DropdownSelect } from './base/DropdownSelect.vue'
export { default as FileInput } from './base/FileInput.vue'
export { default as DropArea } from './base/DropArea.vue'
export { default as Toggle } from './base/Toggle.vue'
export { default as Categories } from './search/Categories.vue'
export { default as SearchFilter } from './search/SearchFilter.vue'