@baklavue/mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +72 -0
  2. package/dist/data/component-categories.d.ts +7 -0
  3. package/dist/data/component-categories.js +48 -0
  4. package/dist/data/loaders.d.ts +22 -0
  5. package/dist/data/loaders.js +346 -0
  6. package/dist/docs/components/accordion.md +601 -0
  7. package/dist/docs/components/alert.md +233 -0
  8. package/dist/docs/components/badge.md +100 -0
  9. package/dist/docs/components/banner.md +231 -0
  10. package/dist/docs/components/button.md +324 -0
  11. package/dist/docs/components/checkbox.md +343 -0
  12. package/dist/docs/components/chip.md +199 -0
  13. package/dist/docs/components/datepicker.md +243 -0
  14. package/dist/docs/components/dialog.md +224 -0
  15. package/dist/docs/components/drawer.md +188 -0
  16. package/dist/docs/components/dropdown.md +291 -0
  17. package/dist/docs/components/file-upload.md +248 -0
  18. package/dist/docs/components/icon.md +142 -0
  19. package/dist/docs/components/image.md +161 -0
  20. package/dist/docs/components/index.md +151 -0
  21. package/dist/docs/components/input.md +407 -0
  22. package/dist/docs/components/link.md +249 -0
  23. package/dist/docs/components/notification.md +179 -0
  24. package/dist/docs/components/pagination.md +168 -0
  25. package/dist/docs/components/radio.md +221 -0
  26. package/dist/docs/components/scroll-to-top.md +90 -0
  27. package/dist/docs/components/select.md +239 -0
  28. package/dist/docs/components/skeleton.md +79 -0
  29. package/dist/docs/components/spinner.md +93 -0
  30. package/dist/docs/components/split-button.md +165 -0
  31. package/dist/docs/components/stepper.md +337 -0
  32. package/dist/docs/components/switch.md +144 -0
  33. package/dist/docs/components/tab.md +140 -0
  34. package/dist/docs/components/table.md +362 -0
  35. package/dist/docs/components/tag.md +243 -0
  36. package/dist/docs/components/textarea.md +190 -0
  37. package/dist/docs/components/tooltip.md +155 -0
  38. package/dist/docs/composables/alert.md +87 -0
  39. package/dist/docs/composables/asyncState.md +74 -0
  40. package/dist/docs/composables/base64.md +72 -0
  41. package/dist/docs/composables/breakpoints.md +129 -0
  42. package/dist/docs/composables/clipboard.md +108 -0
  43. package/dist/docs/composables/colorScheme.md +110 -0
  44. package/dist/docs/composables/confirmDialog.md +105 -0
  45. package/dist/docs/composables/containerScroll.md +89 -0
  46. package/dist/docs/composables/cookie.md +137 -0
  47. package/dist/docs/composables/debounce.md +69 -0
  48. package/dist/docs/composables/disclosure.md +69 -0
  49. package/dist/docs/composables/elementSize.md +84 -0
  50. package/dist/docs/composables/fetch.md +257 -0
  51. package/dist/docs/composables/fieldArray.md +104 -0
  52. package/dist/docs/composables/file.md +343 -0
  53. package/dist/docs/composables/focusTrap.md +87 -0
  54. package/dist/docs/composables/formPersistence.md +69 -0
  55. package/dist/docs/composables/formState.md +71 -0
  56. package/dist/docs/composables/formValidation.md +355 -0
  57. package/dist/docs/composables/format.md +107 -0
  58. package/dist/docs/composables/id.md +54 -0
  59. package/dist/docs/composables/index.md +112 -0
  60. package/dist/docs/composables/infiniteQuery.md +104 -0
  61. package/dist/docs/composables/intersectionObserver.md +64 -0
  62. package/dist/docs/composables/lazyQuery.md +68 -0
  63. package/dist/docs/composables/loading.md +91 -0
  64. package/dist/docs/composables/mutation.md +83 -0
  65. package/dist/docs/composables/notification.md +169 -0
  66. package/dist/docs/composables/pagination.md +109 -0
  67. package/dist/docs/composables/polling.md +76 -0
  68. package/dist/docs/composables/previous.md +58 -0
  69. package/dist/docs/composables/query.md +248 -0
  70. package/dist/docs/composables/raf.md +78 -0
  71. package/dist/docs/composables/scrollLock.md +46 -0
  72. package/dist/docs/composables/scrollToError.md +291 -0
  73. package/dist/docs/composables/scrollVisibility.md +60 -0
  74. package/dist/docs/composables/share.md +78 -0
  75. package/dist/docs/composables/slug.md +58 -0
  76. package/dist/docs/composables/stepper.md +117 -0
  77. package/dist/docs/composables/stepperForm.md +74 -0
  78. package/dist/docs/composables/sticky.md +91 -0
  79. package/dist/docs/composables/storage.md +193 -0
  80. package/dist/docs/composables/theme.md +252 -0
  81. package/dist/docs/composables/themePreset.md +62 -0
  82. package/dist/docs/composables/throttle.md +76 -0
  83. package/dist/docs/composables/timer.md +78 -0
  84. package/dist/docs/composables/toggle.md +55 -0
  85. package/dist/docs/guide/contributing.md +364 -0
  86. package/dist/docs/guide/design-tokens.md +29 -0
  87. package/dist/docs/guide/getting-started.md +181 -0
  88. package/dist/docs/guide/installation.md +287 -0
  89. package/dist/docs/guide/localization.md +132 -0
  90. package/dist/docs/guide/mcp.md +141 -0
  91. package/dist/index.d.ts +2 -0
  92. package/dist/index.js +177 -0
  93. package/package.json +48 -0
@@ -0,0 +1,324 @@
1
+ # Button
2
+
3
+ A Vue UI kit component for Baklava's `bl-button` component with enhanced features and full TypeScript support.
4
+
5
+ ## Basic Button
6
+
7
+ Use the Button component with the `variant` prop for different styles.
8
+
9
+ <div class="component-demo">
10
+
11
+ <BvButton variant="primary">Click me</BvButton>
12
+
13
+ </div>
14
+
15
+ ```vue
16
+ <template>
17
+ <BvButton variant="primary" @click="handleClick">Click me</BvButton>
18
+ </template>
19
+
20
+ <script setup>
21
+ import { BvButton } from "@baklavue/ui";
22
+
23
+ const handleClick = () => {
24
+ console.log("Button clicked!");
25
+ };
26
+ </script>
27
+ ```
28
+
29
+ ## Variants
30
+
31
+ The Button component supports four variants: primary, secondary and tertiary
32
+
33
+ <div class="component-demo" style="display: flex; gap: 0.5rem; flex-wrap: wrap">
34
+
35
+ <BvButton variant="primary">Primary</BvButton>
36
+ <BvButton variant="secondary">Secondary</BvButton>
37
+ <BvButton variant="tertiary">Tertiary</BvButton>
38
+
39
+ </div>
40
+
41
+ ```vue
42
+ <template>
43
+ <BvButton variant="primary">Primary</BvButton>
44
+ <BvButton variant="secondary">Secondary</BvButton>
45
+ <BvButton variant="tertiary">Tertiary</BvButton>
46
+ </template>
47
+
48
+ <script setup>
49
+ import { BvButton } from "@baklavue/ui";
50
+ </script>
51
+ ```
52
+
53
+ ## Kinds
54
+
55
+ The Button component supports multiple kinds: default, neutral, success, danger, and custom (with color overrides).
56
+
57
+ <div class="component-demo" style="display: flex; gap: 0.5rem; flex-wrap: wrap">
58
+
59
+ <BvButton kind="default" variant="primary">Default</BvButton>
60
+ <BvButton kind="neutral" variant="primary">Neutral</BvButton>
61
+ <BvButton kind="success" variant="primary">Success</BvButton>
62
+ <BvButton kind="danger" variant="primary">Danger</BvButton>
63
+ <BvButton kind="custom" variant="primary" :custom-class="{ color: '#8b5cf6', highlightColor: '#7c3aed' }">Custom</BvButton>
64
+
65
+ </div>
66
+
67
+ ```vue
68
+ <template>
69
+ <BvButton kind="default" variant="primary">Default</BvButton>
70
+ <BvButton kind="neutral" variant="primary">Neutral</BvButton>
71
+ <BvButton kind="success" variant="primary">Success</BvButton>
72
+ <BvButton kind="danger" variant="primary">Danger</BvButton>
73
+ <BvButton kind="custom" variant="primary" :custom-class="{ color: '#8b5cf6', highlightColor: '#7c3aed' }">Custom</BvButton>
74
+ </template>
75
+
76
+ <script setup>
77
+ import { BvButton } from "@baklavue/ui";
78
+ </script>
79
+ ```
80
+
81
+ ## Sizes
82
+
83
+ The Button component supports three sizes: small, medium, and large.
84
+
85
+ <div class="component-demo" style="display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center">
86
+
87
+ <BvButton size="small">Small</BvButton>
88
+ <BvButton size="medium">Medium</BvButton>
89
+ <BvButton size="large">Large</BvButton>
90
+
91
+ </div>
92
+
93
+ ```vue
94
+ <template>
95
+ <BvButton size="small">Small</BvButton>
96
+ <BvButton size="medium">Medium</BvButton>
97
+ <BvButton size="large">Large</BvButton>
98
+ </template>
99
+
100
+ <script setup>
101
+ import { BvButton } from "@baklavue/ui";
102
+ </script>
103
+ ```
104
+
105
+ ## Loading State
106
+
107
+ Use the `loading` prop to show a loading indicator. Bind it to your async submit handler.
108
+
109
+ <div class="component-demo">
110
+
111
+ <LoadingButtonDemo />
112
+
113
+ </div>
114
+
115
+ ```vue
116
+ <template>
117
+ <BvButton :loading="isLoading" @click="handleClick">Submit</BvButton>
118
+ </template>
119
+
120
+ <script setup>
121
+ import { ref } from "vue";
122
+ import { BvButton } from "@baklavue/ui";
123
+
124
+ const isLoading = ref(false);
125
+
126
+ const handleClick = async () => {
127
+ isLoading.value = true;
128
+ await new Promise((resolve) => setTimeout(resolve, 2000));
129
+ isLoading.value = false;
130
+ };
131
+ </script>
132
+ ```
133
+
134
+ ## Disabled State
135
+
136
+ Use the `disabled` prop to prevent user interaction.
137
+
138
+ <div class="component-demo">
139
+
140
+ <BvButton :disabled="true">Disabled Button</BvButton>
141
+
142
+ </div>
143
+
144
+ ```vue
145
+ <template>
146
+ <BvButton :disabled="true">Disabled Button</BvButton>
147
+ </template>
148
+
149
+ <script setup>
150
+ import { BvButton } from "@baklavue/ui";
151
+ </script>
152
+ ```
153
+
154
+ ## Link Button
155
+
156
+ Provide an `href` prop to render the button as a link (anchor tag).
157
+
158
+ <div class="component-demo">
159
+
160
+ <BvButton href="/about" variant="primary">Go to About</BvButton>
161
+
162
+ </div>
163
+
164
+ ```vue
165
+ <template>
166
+ <BvButton href="/about" variant="primary">Go to About</BvButton>
167
+ </template>
168
+
169
+ <script setup>
170
+ import { BvButton } from "@baklavue/ui";
171
+ </script>
172
+ ```
173
+
174
+ ## With Icon
175
+
176
+ Add an icon using the `icon` prop. Use a valid icon name from Baklava icons.
177
+
178
+ <div class="component-demo">
179
+
180
+ <BvButton icon="info">Icon</BvButton>
181
+
182
+ </div>
183
+
184
+ ```vue
185
+ <template>
186
+ <BvButton icon="info">Icon</BvButton>
187
+ </template>
188
+
189
+ <script setup>
190
+ import { BvButton } from "@baklavue/ui";
191
+ </script>
192
+ ```
193
+
194
+ ## Props
195
+
196
+ | Prop | Type | Default | Description |
197
+ | -------------- | --------------- | ----------- | --------------------------------------------------- |
198
+ | `variant` | `ButtonVariant` | `'primary'` | Button style variant (primary, secondary, tertiary) |
199
+ | `kind` | `ButtonKind` | `'default'` | Button kind (default, neutral, success, danger, custom) |
200
+ | `size` | `ButtonSize` | `'medium'` | Button size (small, medium, large) |
201
+ | `label` | `string` | `undefined` | Button label text |
202
+ | `loadingLabel` | `string` | `'...'` | Label shown during loading state |
203
+ | `loading` | `boolean` | `undefined` | Loading state |
204
+ | `disabled` | `boolean` | `undefined` | Disabled state |
205
+ | `href` | `string` | `undefined` | Link URL (renders as anchor tag) |
206
+ | `target` | `TargetType` | `undefined` | Link target attribute |
207
+ | `icon` | `BaklavaIcon` | `undefined` | Icon name from Baklava icons |
208
+ | `type` | `string` | `'button'` | Button type (button, submit, reset) |
209
+ | `autofocus` | `boolean` | `undefined` | Autofocus attribute |
210
+ | `customClass` | `CustomClass` | `undefined` | Custom color overrides for custom kind |
211
+
212
+ ## Events
213
+
214
+ | Event | Payload | Description |
215
+ | ------- | ------------------------- | ------------------------------ |
216
+ | `click` | `CustomEvent<MouseEvent>` | Emitted when button is clicked |
217
+
218
+ ## Slots
219
+
220
+ | Slot | Props | Description |
221
+ | --------- | ----- | --------------------------------------------------- |
222
+ | `default` | - | Button content (overrides `label` prop if provided) |
223
+
224
+ ## Types
225
+
226
+ ```typescript
227
+ import type { ButtonProps } from "@baklavue/ui";
228
+
229
+ // ButtonVariant: "primary" | "secondary" | "tertiary"
230
+ // ButtonKind: "default" | "neutral" | "success" | "danger" | "custom"
231
+ // ButtonSize: "small" | "medium" | "large"
232
+
233
+ interface ButtonProps {
234
+ variant?: ButtonVariant;
235
+ kind?: ButtonKind;
236
+ size?: ButtonSize;
237
+ label?: string;
238
+ loadingLabel?: string;
239
+ loading?: boolean;
240
+ disabled?: boolean;
241
+ href?: string;
242
+ target?: "_self" | "_blank" | "_parent" | "_top";
243
+ icon?: string;
244
+ type?: "button" | "submit" | "reset";
245
+ autofocus?: boolean;
246
+ customClass?: {
247
+ color?: string;
248
+ highlightColor?: string;
249
+ };
250
+ }
251
+ ```
252
+
253
+ ## Examples
254
+
255
+ ### Form Submit Button
256
+
257
+ Combine with form inputs and use `type="submit"` with loading state for async form submission.
258
+
259
+ <div class="component-demo">
260
+
261
+ <FormSubmitButtonDemo />
262
+
263
+ </div>
264
+
265
+ ```vue
266
+ <template>
267
+ <form @submit.prevent="handleSubmit">
268
+ <BvInput v-model="email" label="Email" />
269
+ <BvButton type="submit" :loading="isSubmitting">Submit</BvButton>
270
+ </form>
271
+ </template>
272
+
273
+ <script setup>
274
+ import { ref } from "vue";
275
+ import { BvButton, BvInput } from "@baklavue/ui";
276
+
277
+ const email = ref("");
278
+ const isSubmitting = ref(false);
279
+
280
+ const handleSubmit = async () => {
281
+ isSubmitting.value = true;
282
+ await new Promise((resolve) => setTimeout(resolve, 1000));
283
+ isSubmitting.value = false;
284
+ };
285
+ </script>
286
+ ```
287
+
288
+ ### Button Group
289
+
290
+ Group related buttons together with flex layout.
291
+
292
+ <div class="component-demo" style="display: flex; gap: 0.5rem">
293
+
294
+ <BvButton variant="primary">Save</BvButton>
295
+ <BvButton variant="secondary">Cancel</BvButton>
296
+ <BvButton variant="tertiary">Delete</BvButton>
297
+
298
+ </div>
299
+
300
+ ```vue
301
+ <template>
302
+ <div style="display: flex; gap: 0.5rem">
303
+ <BvButton variant="primary">Save</BvButton>
304
+ <BvButton variant="secondary">Cancel</BvButton>
305
+ <BvButton variant="tertiary">Delete</BvButton>
306
+ </div>
307
+ </template>
308
+
309
+ <script setup>
310
+ import { BvButton } from "@baklavue/ui";
311
+ </script>
312
+ ```
313
+
314
+ ## Usage Notes
315
+
316
+ - **Label vs Default Slot**: Use the `label` prop for simple text buttons. Use the `#default` slot when you need custom content (e.g. icons, formatted text, or multiple elements).
317
+
318
+ - **Loading State**: Set `loading` to `true` during async operations. The button shows a spinner and is non-clickable while loading. Use `loadingLabel` to customize the accessibility text.
319
+
320
+ - **Link vs Button**: When `href` is provided, the component renders an `<a>` tag instead of `<button>`. Use `target` for external links (e.g. `_blank`).
321
+
322
+ - **Accessibility**: The component follows Baklava's accessibility guidelines and includes proper ARIA attributes for screen readers.
323
+
324
+ - **Styling**: The component uses Baklava's default styling. Custom colors can be applied through the `customClass` prop when using `kind="custom"`, or by overriding component styles.
@@ -0,0 +1,343 @@
1
+ # Checkbox
2
+
3
+ A Vue UI kit component for Baklava's `bl-checkbox` and `bl-checkbox-group` components for boolean or multi-value selections. The Checkbox component can work in two modes: as a single checkbox or as a group container for multiple checkboxes.
4
+
5
+ ## Single Checkbox
6
+
7
+ Use the Checkbox component without the `items` prop to create a single checkbox.
8
+
9
+ ### Basic Single Checkbox
10
+
11
+ <div class="component-demo">
12
+
13
+ <BvCheckbox label="I agree to the terms and conditions" />
14
+
15
+ </div>
16
+
17
+ ```vue
18
+ <template>
19
+ <BvCheckbox v-model="checked" label="I agree to the terms and conditions" />
20
+ </template>
21
+
22
+ <script setup>
23
+ import { ref } from "vue";
24
+ import { BvCheckbox } from "@baklavue/ui";
25
+
26
+ const checked = ref(false);
27
+ </script>
28
+ ```
29
+
30
+ ### With v-model
31
+
32
+ Use v-model for two-way binding of the checked state.
33
+
34
+ <div class="component-demo">
35
+
36
+ <CheckboxSingleDemo />
37
+
38
+ </div>
39
+
40
+ ```vue
41
+ <template>
42
+ <BvCheckbox v-model="checked" label="I agree to the terms and conditions" />
43
+ </template>
44
+
45
+ <script setup>
46
+ import { ref } from "vue";
47
+ import { BvCheckbox } from "@baklavue/ui";
48
+
49
+ const checked = ref(false);
50
+ </script>
51
+ ```
52
+
53
+ ### Disabled State
54
+
55
+ Disable a checkbox to prevent user interaction.
56
+
57
+ <div class="component-demo">
58
+
59
+ <BvCheckbox label="Disabled checkbox" :disabled="true" />
60
+
61
+ </div>
62
+
63
+ ```vue
64
+ <template>
65
+ <BvCheckbox label="Disabled checkbox" :disabled="true" />
66
+ </template>
67
+
68
+ <script setup>
69
+ import { BvCheckbox } from "@baklavue/ui";
70
+ </script>
71
+ ```
72
+
73
+ ### Indeterminate State
74
+
75
+ Use the indeterminate state for "select all" or partial selection scenarios.
76
+
77
+ <div class="component-demo">
78
+
79
+ <BvCheckbox label="Indeterminate checkbox" :indeterminate="true" />
80
+
81
+ </div>
82
+
83
+ ```vue
84
+ <template>
85
+ <BvCheckbox
86
+ v-model="checked"
87
+ label="Select all"
88
+ :indeterminate="indeterminate"
89
+ />
90
+ </template>
91
+
92
+ <script setup>
93
+ import { ref, computed } from "vue";
94
+ import { BvCheckbox } from "@baklavue/ui";
95
+
96
+ const checked = ref(false);
97
+ const children = ref([false, false, false]);
98
+ const indeterminate = computed(() => {
99
+ const some = children.value.some(Boolean);
100
+ const all = children.value.every(Boolean);
101
+ return some && !all;
102
+ });
103
+ </script>
104
+ ```
105
+
106
+ ## Checkbox Group
107
+
108
+ Use the Checkbox component with the `items` prop to create a group of checkboxes. Selected values are bound via v-model as an array.
109
+
110
+ ### Basic Items Example
111
+
112
+ <div class="component-demo">
113
+
114
+ <CheckboxGroupDemo />
115
+
116
+ </div>
117
+
118
+ ```vue
119
+ <template>
120
+ <BvCheckbox v-model="selected" :items="items">
121
+ <template #item="{ item }">{{ item.label }}</template>
122
+ </BvCheckbox>
123
+ </template>
124
+
125
+ <script setup>
126
+ import { ref } from "vue";
127
+ import { BvCheckbox } from "@baklavue/ui";
128
+
129
+ const selected = ref([]);
130
+ const items = [
131
+ { value: "vue", label: "Vue.js" },
132
+ { value: "react", label: "React" },
133
+ { value: "angular", label: "Angular" },
134
+ { value: "svelte", label: "Svelte" },
135
+ ];
136
+ </script>
137
+ ```
138
+
139
+ ### Items with Disabled and Indeterminate
140
+
141
+ Each item in the group can have its own disabled or indeterminate state.
142
+
143
+ <div class="component-demo">
144
+
145
+ <CheckboxDisabledDemo />
146
+
147
+ </div>
148
+
149
+ ```vue
150
+ <template>
151
+ <BvCheckbox v-model="selected" :items="items">
152
+ <template #item="{ item }">{{ item.label }}</template>
153
+ </BvCheckbox>
154
+ </template>
155
+
156
+ <script setup>
157
+ import { ref } from "vue";
158
+ import { BvCheckbox } from "@baklavue/ui";
159
+
160
+ const selected = ref([]);
161
+ const items = [
162
+ { value: "a", label: "Option A" },
163
+ { value: "b", label: "Option B (disabled)", disabled: true },
164
+ ];
165
+ </script>
166
+ ```
167
+
168
+ ### Custom Content with #item Slot
169
+
170
+ Use the `#item` scoped slot to customize the label or content of each checkbox. The slot receives `{ item, index }`.
171
+
172
+ <div class="component-demo">
173
+
174
+ <CheckboxCustomSlotDemo />
175
+
176
+ </div>
177
+
178
+ ```vue
179
+ <template>
180
+ <BvCheckbox v-model="selected" :items="notificationItems">
181
+ <template #item="{ item }">
182
+ <span>{{ item.label }}</span>
183
+ </template>
184
+ </BvCheckbox>
185
+ </template>
186
+
187
+ <script setup>
188
+ import { ref } from "vue";
189
+ import { BvCheckbox } from "@baklavue/ui";
190
+
191
+ const selected = ref([]);
192
+ const notificationItems = [
193
+ { value: "email", label: "Email notifications" },
194
+ { value: "sms", label: "SMS notifications" },
195
+ { value: "push", label: "Push notifications" },
196
+ ];
197
+ </script>
198
+ ```
199
+
200
+ ## Complete Examples
201
+
202
+ ### Preferences Form
203
+
204
+ A complete preferences form using the checkbox group with the `#item` slot:
205
+
206
+ <div class="component-demo">
207
+
208
+ <CheckboxPreferencesDemo />
209
+
210
+ </div>
211
+
212
+ ```vue
213
+ <template>
214
+ <div>
215
+ <h3>Notification Preferences</h3>
216
+ <BvCheckbox v-model="prefs" :items="preferenceItems">
217
+ <template #item="{ item }">
218
+ <span>{{ item.label }}</span>
219
+ </template>
220
+ </BvCheckbox>
221
+ </div>
222
+ </template>
223
+
224
+ <script setup>
225
+ import { ref } from "vue";
226
+ import { BvCheckbox } from "@baklavue/ui";
227
+
228
+ const prefs = ref([]);
229
+ const preferenceItems = [
230
+ { value: "newsletter", label: "Subscribe to newsletter" },
231
+ { value: "updates", label: "Product updates" },
232
+ { value: "marketing", label: "Marketing emails" },
233
+ ];
234
+ </script>
235
+ ```
236
+
237
+ ## Props
238
+
239
+ ### Single Checkbox Mode Props
240
+
241
+ When used as a single checkbox (without `items` prop):
242
+
243
+ | Prop | Type | Default | Description |
244
+ | --------------- | ------------------ | ----------- | ----------------------------------------------- |
245
+ | `modelValue` | `boolean` | `undefined` | Checked state (use v-model for two-way binding) |
246
+ | `disabled` | `boolean` | `undefined` | Whether the checkbox is disabled |
247
+ | `indeterminate` | `boolean` | `undefined` | Whether the checkbox is in indeterminate state |
248
+ | `value` | `string \| number` | `undefined` | Value for form submission |
249
+ | `name` | `string` | `undefined` | Name attribute for the checkbox |
250
+ | `label` | `string` | `undefined` | Label text (can be overridden by default slot) |
251
+
252
+ ### Group Mode Props
253
+
254
+ When used as a checkbox group (with `items` prop):
255
+
256
+ | Prop | Type | Default | Description |
257
+ | ------------ | ---------------------- | ----------- | ------------------------------------------------------------------- |
258
+ | `modelValue` | `(string \| number)[]` | `undefined` | Selected values array (use v-model for two-way binding) |
259
+ | `items` | `CheckboxItem[]` | `undefined` | Array of checkbox items. Each item renders as a bl-checkbox element |
260
+
261
+ ### CheckboxItem Interface
262
+
263
+ When using the `items` prop, each item should follow the `CheckboxItem` interface:
264
+
265
+ | Property | Type | Default | Description |
266
+ | --------------- | ------------------ | ----------- | ----------------------------------------- |
267
+ | `value` | `string \| number` | required | The value of the checkbox (for v-model) |
268
+ | `label` | `string` | `undefined` | Label text displayed next to the checkbox |
269
+ | `checked` | `boolean` | `false` | Whether the checkbox is checked |
270
+ | `disabled` | `boolean` | `false` | Whether the checkbox is disabled |
271
+ | `indeterminate` | `boolean` | `false` | Whether the checkbox is indeterminate |
272
+ | `name` | `string` | `undefined` | Name attribute for the checkbox |
273
+
274
+ Items may include additional custom data for use in the `#item` slot.
275
+
276
+ ## Events
277
+
278
+ ### Single Checkbox Mode Events
279
+
280
+ When used as a single checkbox:
281
+
282
+ | Event | Payload | Description |
283
+ | ------------------- | ------------- | ------------------------------------------------ |
284
+ | `update:modelValue` | `boolean` | Emitted when checked state changes (for v-model) |
285
+ | `change` | `CustomEvent` | Emitted when the checkbox state changes |
286
+ | `input` | `CustomEvent` | Emitted on input (native bl-input event) |
287
+
288
+ ### Group Mode Events
289
+
290
+ When used as a checkbox group:
291
+
292
+ | Event | Payload | Description |
293
+ | ------------------- | ---------------------- | -------------------------------------------- |
294
+ | `update:modelValue` | `(string \| number)[]` | Emitted when selection changes (for v-model) |
295
+ | `change` | `CustomEvent` | Emitted when the selection changes |
296
+
297
+ ## Slots
298
+
299
+ | Slot | Props | Description |
300
+ | --------- | ----------------- | --------------------------------------------------------------- |
301
+ | `default` | - | Label content for single checkbox mode (overrides `label` prop) |
302
+ | `item` | `{ item, index }` | Scoped slot for each checkbox item content in group mode |
303
+
304
+ ## Types
305
+
306
+ ```typescript
307
+ import type { CheckboxProps, CheckboxItem } from "@baklavue/ui";
308
+
309
+ interface CheckboxItem {
310
+ value: string | number;
311
+ label?: string;
312
+ checked?: boolean;
313
+ disabled?: boolean;
314
+ indeterminate?: boolean;
315
+ name?: string;
316
+ [key: string]: unknown; // Additional custom data for #item slot
317
+ }
318
+
319
+ interface CheckboxProps {
320
+ // Single checkbox mode props
321
+ modelValue?: boolean | (string | number)[];
322
+ disabled?: boolean;
323
+ indeterminate?: boolean;
324
+ value?: string | number;
325
+ name?: string;
326
+ label?: string;
327
+
328
+ // Group mode props
329
+ items?: CheckboxItem[];
330
+ }
331
+ ```
332
+
333
+ ## Usage Notes
334
+
335
+ - **Single vs Group Mode**: The component automatically switches between single checkbox mode and group mode based on whether the `items` prop is provided. When `items` is `undefined`, it acts as a single checkbox. When `items` is an array, it acts as a group container using `bl-checkbox-group`.
336
+
337
+ - **Items Prop Required**: In group mode, checkboxes are rendered from the `items` prop. Content for each item is provided via the `#item` scoped slot or defaults to `item.label`.
338
+
339
+ - **v-model Behavior**: In single mode, v-model binds a boolean. In group mode, v-model binds an array of selected values (strings or numbers).
340
+
341
+ - **Accessibility**: The component follows Baklava's accessibility guidelines and includes proper ARIA attributes for screen readers.
342
+
343
+ - **Styling**: The component uses Baklava's default styling. Custom styling can be applied through CSS variables or by overriding the component styles.