Skip to content

Instantly share code, notes, and snippets.

@SteinRobert
Last active July 8, 2019 10:25
Show Gist options
  • Select an option

  • Save SteinRobert/e6510fe2dbf71e17113e1af33dd6eef4 to your computer and use it in GitHub Desktop.

Select an option

Save SteinRobert/e6510fe2dbf71e17113e1af33dd6eef4 to your computer and use it in GitHub Desktop.
<template>
<div>
<input type="checkbox" :name="name" :id="id" :checked="active">
</div>
</template>
<script>
export default {
name: 'Toggle',
props: {
name: {
type: String,
default: ''
},
id: {
type: String,
default: () => {
// Taken from https://gist.github.com/gordonbrander/2230317
return 'toggle-' + Math.random().toString(36).substr(2, 9);
}
},
active: {
type: Boolean,
default: false
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment