@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,199 @@
1
+ # Chip
2
+
3
+ An indicator of a numeric value or a state. Wraps another element and displays a badge positioned at a corner.
4
+
5
+ ## Basic
6
+
7
+ Wrap a button or icon with a Chip to display a notification count or label.
8
+
9
+ <div class="component-demo">
10
+
11
+ <ChipBasicDemo />
12
+
13
+ </div>
14
+
15
+ ```vue
16
+ <template>
17
+ <BvChip :text="5">
18
+ <BvButton kind="neutral" variant="tertiary" icon="mail" />
19
+ </BvChip>
20
+ </template>
21
+
22
+ <script setup>
23
+ import { BvButton, BvChip } from "@baklavue/ui";
24
+ </script>
25
+ ```
26
+
27
+ ## Colors
28
+
29
+ Use the `color` prop to change the chip color.
30
+
31
+ <div class="component-demo" style="display: flex; flex-wrap: wrap; gap: 1rem; align-items: center">
32
+
33
+ <ChipColorsDemo />
34
+
35
+ </div>
36
+
37
+ ```vue
38
+ <template>
39
+ <BvChip color="primary" :text="5">...</BvChip>
40
+ <BvChip color="success" :text="3">...</BvChip>
41
+ <BvChip color="danger" :text="12">...</BvChip>
42
+ <BvChip color="warning" :text="!">...</BvChip>
43
+ <BvChip color="info" :text="2">...</BvChip>
44
+ <BvChip color="neutral" :text="9">...</BvChip>
45
+ </template>
46
+ ```
47
+
48
+ ## Sizes
49
+
50
+ Use the `size` prop to change the chip size.
51
+
52
+ <div class="component-demo">
53
+
54
+ <ChipSizesDemo />
55
+
56
+ </div>
57
+
58
+ ```vue
59
+ <template>
60
+ <BvChip size="xs" :text="1">...</BvChip>
61
+ <BvChip size="sm" :text="5">...</BvChip>
62
+ <BvChip size="md" :text="12">...</BvChip>
63
+ <BvChip size="lg" :text="99">...</BvChip>
64
+ </template>
65
+ ```
66
+
67
+ ## Position
68
+
69
+ Use the `position` prop to change where the chip appears relative to the wrapped element.
70
+
71
+ <div class="component-demo">
72
+
73
+ <ChipPositionDemo />
74
+
75
+ </div>
76
+
77
+ ```vue
78
+ <template>
79
+ <BvChip position="top-right" :text="5">...</BvChip>
80
+ <BvChip position="bottom-right" :text="5">...</BvChip>
81
+ <BvChip position="top-left" :text="5">...</BvChip>
82
+ <BvChip position="bottom-left" :text="5">...</BvChip>
83
+ </template>
84
+ ```
85
+
86
+ ## Inset
87
+
88
+ Use the `inset` prop to keep the chip inside rounded elements like avatars.
89
+
90
+ <div class="component-demo">
91
+
92
+ <ChipInsetDemo />
93
+
94
+ </div>
95
+
96
+ ```vue
97
+ <template>
98
+ <BvChip :text="5" inset color="primary">
99
+ <div
100
+ class="avatar"
101
+ style="width: 40px; height: 40px; border-radius: 50%; ..."
102
+ />
103
+ </BvChip>
104
+ </template>
105
+ ```
106
+
107
+ ## Standalone
108
+
109
+ Use the `standalone` prop to display the chip inline without wrapping any content.
110
+
111
+ <div class="component-demo">
112
+
113
+ <ChipStandaloneDemo />
114
+
115
+ </div>
116
+
117
+ ```vue
118
+ <template>
119
+ <BvChip standalone :text="5" />
120
+ <BvChip standalone text="New" color="success" />
121
+ <BvChip standalone text="99+" color="danger" size="lg" />
122
+ </template>
123
+
124
+ <script setup>
125
+ import { BvChip } from "@baklavue/ui";
126
+ </script>
127
+ ```
128
+
129
+ ## Control Visibility
130
+
131
+ Use the `show` prop to control when the chip is visible.
132
+
133
+ <div class="component-demo">
134
+
135
+ <ChipShowDemo />
136
+
137
+ </div>
138
+
139
+ ```vue
140
+ <template>
141
+ <BvChip :text="5" :show="show">
142
+ <BvButton kind="neutral" variant="tertiary" icon="mail" />
143
+ </BvChip>
144
+ <BvButton @click="show = !show">{{ show ? "Hide" : "Show" }} chip</BvButton>
145
+ </template>
146
+
147
+ <script setup>
148
+ import { ref } from "vue";
149
+ import { BvButton, BvChip } from "@baklavue/ui";
150
+
151
+ const show = ref(true);
152
+ </script>
153
+ ```
154
+
155
+ ## Props
156
+
157
+ | Prop | Type | Default | Description |
158
+ | ------------ | ------------------ | ------------- | ---------------------------------------------------------------- |
159
+ | `text` | `string \| number` | - | Text or number displayed inside the chip |
160
+ | `color` | `ChipColor` | `'primary'` | Color variant (primary, success, danger, warning, info, neutral) |
161
+ | `size` | `ChipSize` | `'md'` | Size variant (xs, sm, md, lg) |
162
+ | `position` | `ChipPosition` | `'top-right'` | Position (top-right, bottom-right, top-left, bottom-left) |
163
+ | `inset` | `boolean` | `false` | Keep chip inside rounded elements |
164
+ | `standalone` | `boolean` | `false` | Render inline without wrapping content |
165
+ | `show` | `boolean` | `true` | When false, hide the chip |
166
+
167
+ ## Slots
168
+
169
+ | Slot | Description |
170
+ | --------- | ----------------------------- |
171
+ | `default` | Wrapped element (e.g. button) |
172
+ | `content` | Override chip content |
173
+
174
+ ## Types
175
+
176
+ ```typescript
177
+ import type {
178
+ ChipProps,
179
+ ChipColor,
180
+ ChipSize,
181
+ ChipPosition,
182
+ } from "@baklavue/ui";
183
+
184
+ const props: ChipProps = {
185
+ text: 5,
186
+ color: "primary",
187
+ size: "md",
188
+ position: "top-right",
189
+ inset: false,
190
+ standalone: false,
191
+ show: true,
192
+ };
193
+ ```
194
+
195
+ ## Usage Notes
196
+
197
+ - **Notification counts**: Use the chip to show unread counts on mail, notification, or message icons.
198
+ - **Status indicators**: Use with avatars to show online/offline status.
199
+ - **Standalone badges**: Use `standalone` for inline badges in inputs, selects, or command palettes.
@@ -0,0 +1,243 @@
1
+ # Datepicker
2
+
3
+ A Vue UI kit component for Baklava's `bl-datepicker` component with v-model support for date selection. The Datepicker provides a calendar picker input with options for min/max date constraints, placeholder text, and standard form states.
4
+
5
+ ## Basic Usage
6
+
7
+ Use v-model for two-way binding of the selected date.
8
+
9
+ <div class="component-demo">
10
+
11
+ <DatepickerDemo variant="basic" />
12
+
13
+ </div>
14
+
15
+ ```vue
16
+ <template>
17
+ <BvDatepicker v-model="date" label="Select date" />
18
+ </template>
19
+
20
+ <script setup>
21
+ import { ref } from "vue";
22
+ import { BvDatepicker } from "@baklavue/ui";
23
+
24
+ const date = ref("");
25
+ </script>
26
+ ```
27
+
28
+ ## With Placeholder
29
+
30
+ Add a placeholder to guide users when no date is selected.
31
+
32
+ <div class="component-demo">
33
+
34
+ <DatepickerDemo variant="placeholder" />
35
+
36
+ </div>
37
+
38
+ ```vue
39
+ <template>
40
+ <BvDatepicker v-model="date" label="Appointment" placeholder="Pick a date" />
41
+ </template>
42
+
43
+ <script setup>
44
+ import { ref } from "vue";
45
+ import { BvDatepicker } from "@baklavue/ui";
46
+
47
+ const date = ref("");
48
+ </script>
49
+ ```
50
+
51
+ ## Disabled State
52
+
53
+ Disable the datepicker to prevent user interaction.
54
+
55
+ <div class="component-demo">
56
+
57
+ <DatepickerDemo variant="disabled" />
58
+
59
+ </div>
60
+
61
+ ```vue
62
+ <template>
63
+ <BvDatepicker v-model="date" label="Disabled datepicker" :disabled="true" />
64
+ </template>
65
+
66
+ <script setup>
67
+ import { ref } from "vue";
68
+ import { BvDatepicker } from "@baklavue/ui";
69
+
70
+ const date = ref("");
71
+ </script>
72
+ ```
73
+
74
+ ## Required State
75
+
76
+ Mark the datepicker as required for form validation.
77
+
78
+ <div class="component-demo">
79
+
80
+ <DatepickerDemo variant="required" />
81
+
82
+ </div>
83
+
84
+ ```vue
85
+ <template>
86
+ <BvDatepicker v-model="date" label="Required date" :required="true" />
87
+ </template>
88
+
89
+ <script setup>
90
+ import { ref } from "vue";
91
+ import { BvDatepicker } from "@baklavue/ui";
92
+
93
+ const date = ref("");
94
+ </script>
95
+ ```
96
+
97
+ ## Min/Max Dates
98
+
99
+ Restrict selectable dates using the `min` and `max` props. Dates should be provided as ISO date strings (YYYY-MM-DD).
100
+
101
+ <div class="component-demo">
102
+
103
+ <DatepickerDemo variant="minmax" />
104
+
105
+ </div>
106
+
107
+ ```vue
108
+ <template>
109
+ <BvDatepicker
110
+ v-model="date"
111
+ label="Date range"
112
+ placeholder="Select within range"
113
+ :min="minDate"
114
+ :max="maxDate"
115
+ />
116
+ </template>
117
+
118
+ <script setup>
119
+ import { ref, computed } from "vue";
120
+ import { BvDatepicker } from "@baklavue/ui";
121
+
122
+ const date = ref("");
123
+ // Example: restrict to current month
124
+ const now = new Date();
125
+ const minDate = computed(
126
+ () =>
127
+ `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-01`,
128
+ );
129
+ const maxDate = computed(
130
+ () =>
131
+ `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(
132
+ new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate(),
133
+ ).padStart(2, "0")}`,
134
+ );
135
+ </script>
136
+ ```
137
+
138
+ ## Multiple Dates
139
+
140
+ Select multiple dates by setting `type="multiple"`.
141
+
142
+ <div class="component-demo">
143
+
144
+ <DatepickerDemo variant="multiple" />
145
+
146
+ </div>
147
+
148
+ ```vue
149
+ <template>
150
+ <BvDatepicker v-model="dates" type="multiple" label="Select dates" />
151
+ </template>
152
+
153
+ <script setup>
154
+ import { ref } from "vue";
155
+ import { BvDatepicker } from "@baklavue/ui";
156
+
157
+ const dates = ref<string[]>([]);
158
+ </script>
159
+ ```
160
+
161
+ ## Date Range
162
+
163
+ Select a date range by setting `type="range"`.
164
+
165
+ <div class="component-demo">
166
+
167
+ <DatepickerDemo variant="range" />
168
+
169
+ </div>
170
+
171
+ ```vue
172
+ <template>
173
+ <BvDatepicker v-model="range" type="range" label="Select range" />
174
+ </template>
175
+
176
+ <script setup>
177
+ import { ref } from "vue";
178
+ import { BvDatepicker } from "@baklavue/ui";
179
+
180
+ const range = (ref < [string, string]) | (null > null);
181
+ </script>
182
+ ```
183
+
184
+ ## Props
185
+
186
+ | Prop | Type | Default | Description |
187
+ | ------------- | ------------------------------------------------ | ----------- | --------------------------------- |
188
+ | `modelValue` | `string \| string[] \| [string, string] \| null` | `undefined` | Selected date(s) (v-model) |
189
+ | `type` | `"single" \| "multiple" \| "range"` | `"single"` | Selection mode |
190
+ | `label` | `string` | `undefined` | Datepicker label |
191
+ | `placeholder` | `string` | `undefined` | Placeholder text |
192
+ | `disabled` | `boolean` | `undefined` | Disabled state |
193
+ | `min` | `string` | `undefined` | Minimum selectable date |
194
+ | `max` | `string` | `undefined` | Maximum selectable date |
195
+ | `required` | `boolean` | `undefined` | Required field |
196
+ | `size` | `InputSize` | `undefined` | Input size (small, medium, large) |
197
+ | `labelFixed` | `boolean` | `undefined` | Makes the label fixed positioned |
198
+ | `helpText` | `string` | `undefined` | Help text below the input |
199
+
200
+ ## Events
201
+
202
+ | Event | Payload | Description |
203
+ | ------------------- | ------------------------------------------------ | ----------------------------------------------------- |
204
+ | `update:modelValue` | `string \| string[] \| [string, string] \| null` | Emitted when date(s) change |
205
+ | `change` | `CustomEvent<Date[]>` | Emitted when selection changes (bl-datepicker-change) |
206
+
207
+ ## Slots
208
+
209
+ | Slot | Props | Description |
210
+ | --------- | ----- | ---------------------------------------- |
211
+ | `default` | - | Optional content passed to bl-datepicker |
212
+
213
+ ## Types
214
+
215
+ ```typescript
216
+ import type { DatepickerProps, DatepickerType } from "@baklavue/ui";
217
+
218
+ type DatepickerType = "single" | "multiple" | "range";
219
+
220
+ interface DatepickerProps {
221
+ modelValue?: string | string[] | [string, string] | null;
222
+ type?: DatepickerType;
223
+ label?: string;
224
+ placeholder?: string;
225
+ disabled?: boolean;
226
+ min?: string;
227
+ max?: string;
228
+ required?: boolean;
229
+ size?: InputSize;
230
+ labelFixed?: boolean;
231
+ helpText?: string;
232
+ }
233
+ ```
234
+
235
+ ## Usage Notes
236
+
237
+ - **v-model Binding**: Use v-model for two-way binding. For `type="single"`, value is `string | null`. For `type="multiple"`, value is `string[]`. For `type="range"`, value is `[string, string] | null`.
238
+
239
+ - **Date Format**: The `min`, `max`, and `modelValue` use ISO date strings (YYYY-MM-DD).
240
+
241
+ - **Accessibility**: The component follows Baklava's accessibility guidelines and includes proper ARIA attributes for screen readers.
242
+
243
+ - **Styling**: The component uses Baklava's default styling. Custom styling can be applied through CSS variables or by overriding the component styles.
@@ -0,0 +1,224 @@
1
+ # Dialog
2
+
3
+ A Vue UI kit component for Baklava's `bl-dialog` component for modal dialogs. The Dialog component provides a modal overlay for confirmations, forms, and important content with support for header and footer slots, controllable visibility, and programmatic open/close.
4
+
5
+ ## Basic Usage
6
+
7
+ Use `v-model:open` for two-way binding. Trigger the dialog with a button.
8
+
9
+ <div class="component-demo">
10
+
11
+ <DialogBasicDemo />
12
+
13
+ </div>
14
+
15
+ ```vue
16
+ <template>
17
+ <div>
18
+ <BvButton @click="showDialog = true">Open Dialog</BvButton>
19
+ <BvDialog v-model:open="showDialog">
20
+ <template #header>
21
+ <span>Dialog Title</span>
22
+ </template>
23
+ <p>Dialog content goes here.</p>
24
+ </BvDialog>
25
+ </div>
26
+ </template>
27
+
28
+ <script setup>
29
+ import { ref } from "vue";
30
+ import { BvDialog, BvButton } from "@baklavue/ui";
31
+
32
+ const showDialog = ref(false);
33
+ </script>
34
+ ```
35
+
36
+ ## Caption
37
+
38
+ Use the `caption` prop for a simple text title instead of the header slot. This maps to Baklava's `bl-dialog` caption attribute.
39
+
40
+ <div class="component-demo">
41
+
42
+ <DialogCaptionDemo />
43
+
44
+ </div>
45
+
46
+ ```vue
47
+ <template>
48
+ <div>
49
+ <BvButton @click="showDialog = true">Open Dialog</BvButton>
50
+ <BvDialog v-model:open="showDialog" caption="Simple Title">
51
+ <p>Use the caption prop for a simple text title instead of the header slot.</p>
52
+ </BvDialog>
53
+ </div>
54
+ </template>
55
+
56
+ <script setup>
57
+ import { ref } from "vue";
58
+ import { BvDialog, BvButton } from "@baklavue/ui";
59
+
60
+ const showDialog = ref(false);
61
+ </script>
62
+ ```
63
+
64
+ ## With Header and Footer
65
+
66
+ Use the `header` and `footer` slots to add a title and action buttons (e.g. Cancel, Confirm).
67
+
68
+ <div class="component-demo">
69
+
70
+ <DialogHeaderFooterDemo />
71
+
72
+ </div>
73
+
74
+ ```vue
75
+ <template>
76
+ <div>
77
+ <BvButton @click="showDialog = true">Open Dialog</BvButton>
78
+ <BvDialog v-model:open="showDialog">
79
+ <template #header>
80
+ <span>Confirm Action</span>
81
+ </template>
82
+ <p>Are you sure you want to proceed? This action cannot be undone.</p>
83
+ <template #footer>
84
+ <div style="display: flex; gap: 0.5rem; justify-content: flex-end;">
85
+ <BvButton variant="tertiary" @click="showDialog = false">Cancel</BvButton>
86
+ <BvButton variant="primary" @click="showDialog = false">Confirm</BvButton>
87
+ </div>
88
+ </template>
89
+ </BvDialog>
90
+ </div>
91
+ </template>
92
+
93
+ <script setup>
94
+ import { ref } from "vue";
95
+ import { BvDialog, BvButton } from "@baklavue/ui";
96
+
97
+ const showDialog = ref(false);
98
+ </script>
99
+ ```
100
+
101
+ ## Closable and Backdrop
102
+
103
+ Control whether the dialog can be closed via the close button (`closable`) and whether clicking the backdrop closes it (`backdrop`). When `closable` is `true`, a close button is shown in the header. When `backdrop` is `true`, the dialog closes when clicking outside.
104
+
105
+ <div class="component-demo">
106
+
107
+ <DialogClosableDemo />
108
+
109
+ </div>
110
+
111
+ ```vue
112
+ <template>
113
+ <BvDialog v-model:open="showDialog" :closable="true">
114
+ <template #header>
115
+ <span>Closable Dialog</span>
116
+ </template>
117
+ <p>This dialog has a close button.</p>
118
+ </BvDialog>
119
+ </template>
120
+
121
+ <script setup>
122
+ import { ref } from "vue";
123
+ import { BvDialog } from "@baklavue/ui";
124
+
125
+ const showDialog = ref(false);
126
+ </script>
127
+ ```
128
+
129
+ ## Size
130
+
131
+ Use the `size` prop to control the dialog width. Accepts values supported by the underlying `bl-dialog` (e.g. `"small"`, `"medium"`, `"large"` or custom CSS values).
132
+
133
+ ## Programmatic Control
134
+
135
+ Access dialog methods programmatically using template refs. Call `open()` to show the dialog and `close()` to hide it.
136
+
137
+ <div class="component-demo">
138
+
139
+ <DialogProgrammaticDemo />
140
+
141
+ </div>
142
+
143
+ ```vue
144
+ <template>
145
+ <div>
146
+ <div style="margin-bottom: 1rem; display: flex; gap: 0.5rem;">
147
+ <BvButton @click="dialogRef?.open()">Open</BvButton>
148
+ <BvButton @click="dialogRef?.close()">Close</BvButton>
149
+ </div>
150
+ <BvDialog ref="dialogRef">
151
+ <template #header>
152
+ <span>Programmatically Controlled</span>
153
+ </template>
154
+ <p>This dialog can be opened and closed via button clicks or programmatically.</p>
155
+ </BvDialog>
156
+ </div>
157
+ </template>
158
+
159
+ <script setup>
160
+ import { ref } from "vue";
161
+ import { BvDialog, BvButton } from "@baklavue/ui";
162
+
163
+ const dialogRef = ref();
164
+ </script>
165
+ ```
166
+
167
+ ## Props
168
+
169
+ | Prop | Type | Default | Description |
170
+ | ---------- | --------- | ----------- | -------------------------------------------------------------- |
171
+ | `open` | `boolean` | `false` | Whether the dialog is visible (use with `v-model:open`) |
172
+ | `caption` | `string` | `undefined` | Optional dialog title. Maps to bl-dialog's caption attribute |
173
+ | `closable` | `boolean` | `undefined` | Whether to show the close button in the header |
174
+ | `backdrop` | `boolean` | `undefined` | Whether clicking the backdrop closes the dialog |
175
+ | `size` | `string` | `undefined` | Dialog width (e.g. `"small"`, `"medium"`, `"large"` or custom) |
176
+
177
+ ## Events
178
+
179
+ | Event | Payload | Description |
180
+ | --------------- | --------- | ---------------------------------------------------------------- |
181
+ | `update:open` | `boolean` | Emitted when visibility changes. Use for two-way binding. |
182
+ | `open` | - | Emitted when the dialog is opened |
183
+ | `close` | - | Emitted when the dialog is closed |
184
+
185
+ ## Methods
186
+
187
+ You can access these methods via template refs:
188
+
189
+ | Method | Description |
190
+ | -------- | ------------------------------------- |
191
+ | `open()` | Opens the dialog programmatically |
192
+ | `close()`| Closes the dialog programmatically |
193
+
194
+ ## Slots
195
+
196
+ | Slot | Props | Description |
197
+ | --------- | ----- | ------------------------------------- |
198
+ | `header` | - | Content for the dialog header/title |
199
+ | `default`| - | Main dialog content |
200
+ | `footer` | - | Content for the dialog footer |
201
+
202
+ ## Types
203
+
204
+ ```typescript
205
+ import type { DialogProps } from "@baklavue/ui";
206
+
207
+ interface DialogProps {
208
+ open?: boolean;
209
+ caption?: string;
210
+ closable?: boolean;
211
+ backdrop?: boolean;
212
+ size?: string;
213
+ }
214
+ ```
215
+
216
+ ## Usage Notes
217
+
218
+ - **Two-way binding**: Use `v-model:open` to control visibility. Alternatively, use a template ref and call `open()` / `close()`.
219
+
220
+ - **Caption vs header slot**: Use the `caption` prop for a simple text title. Use the `#header` slot for custom header content (icons, rich markup, etc.).
221
+
222
+ - **Accessibility**: The component follows Baklava's accessibility guidelines. The underlying `bl-dialog` uses the native HTML `<dialog>` element (or a polyfill) for proper focus management and ARIA attributes.
223
+
224
+ - **Styling**: The component uses Baklava's default styling. Custom styling can be applied through CSS variables such as `--bl-dialog-width` and `--bl-dialog-caption-line-clamp`.