Skip to content

Commit

Permalink
1,506th Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed Jul 7, 2024
1 parent a75ddea commit 57b8ed0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<script lang="ts" setup>
import { reactive, watch } from 'vue';
import { XBreadcrumb, XCard, XCheckbox } from '@x/ui';
import { XBreadcrumb, XCard, XCodeBlock, XCheckbox } from '@x/ui';
import Basic from './Basic.vue';
import BasicCode from './Basic.vue?raw';
const flux = reactive({
checkbox1: false,
Expand Down Expand Up @@ -43,9 +46,10 @@ watch(
<h2 class="text-3xl font-bold my-4">Basic</h2>

<XCard>
<XCheckbox v-model:value="flux.checkbox1">Checkbox 1</XCheckbox>
<div class="mt-1">{{ flux.checkbox1 }}</div>
<Basic />
</XCard>

<XCodeBlock :code="BasicCode" language="vue" />
</section>

<section class="my-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { XCheckbox } from '@x/ui';
const value = ref(false);
</script>

<template>
<XCheckbox v-model:value="value" label="Example label" />

<div class="flex gap-1 mt-1">
Output:
<pre>{{ value }}</pre>
</div>
</template>
2 changes: 2 additions & 0 deletions ui/src/components/checkbox/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { computed } from 'vue';
import uniqueId from 'lodash/uniqueId';
interface Props extends /* @vue-ignore */ InputHTMLAttributes {
label?: string;
value?: boolean;
checked?: boolean;
indeterminate?: boolean;
Expand Down Expand Up @@ -58,6 +59,7 @@ const uid = uniqueId('uid-');
</div>

<div class="Checkbox-Text">
{{ label }}
<slot></slot>
</div>
</label>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/form-control/FormControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const uid = uniqueId('uid-');
<template>
<div class="flex flex-col w-full">
<div v-if="label" class="flex items-center text-sm mb-1">
<label :for="uid" class="inline-flex font-bold empty:hidden">{{ label }} </label>
<label :for="uid" class="inline-flex font-bold empty:hidden">{{ label }}</label>
<span v-if="required" class="text-red-500 ms-0.5">*</span>
<slot name="label"></slot>
</div>
Expand Down

0 comments on commit 57b8ed0

Please sign in to comment.