Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Add BBCheckbox

天舟c4ae69ce7356
diff --git a/frontend/src/bbkit/BBCheckbox.vue b/frontend/src/bbkit/BBCheckbox.vue
new file mode 100644
index 0000000000..8609286477
--- /dev/null
+++ b/frontend/src/bbkit/BBCheckbox.vue
@@ -0,0 +1,43 @@
+<template>
+ <div class="relative flex items-start">
+ <div class="flex items-center h-5">
+ <input
+ type="checkbox"
+ class="focus:ring-accent h-4 w-4 text-accent border-control-border rounded"
+ :checked="value"
+ @input="
+ () => {
+ on = !on;
+ $emit('toggle', on);
+ }
+ "
+ />
+ </div>
+ <div v-if="label" class="ml-2 text-sm">
+ <label class="font-medium text-main">{{ label }}</label>
+ </div>
+ </div>
+</template>
+
+<script lang="ts">
+import { ref } from "vue";
+
+export default {
+ name: "BBCheckbox",
+ emits: ["toggle"],
+ props: {
+ label: {
+ default: "",
+ type: String,
+ },
+ value: {
+ default: true,
+ type: Boolean,
+ },
+ },
+ setup(props, ctx) {
+ const on = ref(props.value);
+ return { on };
+ },
+};
+</script>
diff --git a/frontend/src/bbkit/index.ts b/frontend/src/bbkit/index.ts
index c6bc83aa85..a87a46b7de 100644
--- a/frontend/src/bbkit/index.ts
+++ b/frontend/src/bbkit/index.ts
@@ -2,6 +2,7 @@ import BBAlert from "./BBAlert.vue";
import BBAvatar from "./BBAvatar.vue";
import BBButtonAdd from "./BBButtonAdd.vue";
import BBButtonTrash from "./BBButtonTrash.vue";
+import BBCheckbox from "./BBCheckbox.vue";
import BBContextMenu from "./BBContextMenu.vue";
import BBModal from "./BBModal.vue";
import BBNotification from "./BBNotification.vue";
@@ -25,6 +26,7 @@ export {
BBAvatar,
BBButtonAdd,
BBButtonTrash,
+ BBCheckbox,
BBContextMenu,
BBModal,
BBNotification,
diff --git a/frontend/src/main.js b/frontend/src/main.js
index 3529ee9949..f24f6a8b63 100644
--- a/frontend/src/main.js
+++ b/frontend/src/main.js
@@ -12,6 +12,7 @@ import {
BBAvatar,
BBButtonAdd,
BBButtonTrash,
+ BBCheckbox,
BBContextMenu,
BBModal,
BBNotification,
@@ -71,6 +72,7 @@ app
.component("BBAvatar", BBAvatar)
.component("BBButtonAdd", BBButtonAdd)
.component("BBButtonTrash", BBButtonTrash)
+ .component("BBCheckbox", BBCheckbox)
.component("BBContextMenu", BBContextMenu)
.component("BBModal", BBModal)
.component("BBNotification", BBNotification)