@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.
- package/README.md +72 -0
- package/dist/data/component-categories.d.ts +7 -0
- package/dist/data/component-categories.js +48 -0
- package/dist/data/loaders.d.ts +22 -0
- package/dist/data/loaders.js +346 -0
- package/dist/docs/components/accordion.md +601 -0
- package/dist/docs/components/alert.md +233 -0
- package/dist/docs/components/badge.md +100 -0
- package/dist/docs/components/banner.md +231 -0
- package/dist/docs/components/button.md +324 -0
- package/dist/docs/components/checkbox.md +343 -0
- package/dist/docs/components/chip.md +199 -0
- package/dist/docs/components/datepicker.md +243 -0
- package/dist/docs/components/dialog.md +224 -0
- package/dist/docs/components/drawer.md +188 -0
- package/dist/docs/components/dropdown.md +291 -0
- package/dist/docs/components/file-upload.md +248 -0
- package/dist/docs/components/icon.md +142 -0
- package/dist/docs/components/image.md +161 -0
- package/dist/docs/components/index.md +151 -0
- package/dist/docs/components/input.md +407 -0
- package/dist/docs/components/link.md +249 -0
- package/dist/docs/components/notification.md +179 -0
- package/dist/docs/components/pagination.md +168 -0
- package/dist/docs/components/radio.md +221 -0
- package/dist/docs/components/scroll-to-top.md +90 -0
- package/dist/docs/components/select.md +239 -0
- package/dist/docs/components/skeleton.md +79 -0
- package/dist/docs/components/spinner.md +93 -0
- package/dist/docs/components/split-button.md +165 -0
- package/dist/docs/components/stepper.md +337 -0
- package/dist/docs/components/switch.md +144 -0
- package/dist/docs/components/tab.md +140 -0
- package/dist/docs/components/table.md +362 -0
- package/dist/docs/components/tag.md +243 -0
- package/dist/docs/components/textarea.md +190 -0
- package/dist/docs/components/tooltip.md +155 -0
- package/dist/docs/composables/alert.md +87 -0
- package/dist/docs/composables/asyncState.md +74 -0
- package/dist/docs/composables/base64.md +72 -0
- package/dist/docs/composables/breakpoints.md +129 -0
- package/dist/docs/composables/clipboard.md +108 -0
- package/dist/docs/composables/colorScheme.md +110 -0
- package/dist/docs/composables/confirmDialog.md +105 -0
- package/dist/docs/composables/containerScroll.md +89 -0
- package/dist/docs/composables/cookie.md +137 -0
- package/dist/docs/composables/debounce.md +69 -0
- package/dist/docs/composables/disclosure.md +69 -0
- package/dist/docs/composables/elementSize.md +84 -0
- package/dist/docs/composables/fetch.md +257 -0
- package/dist/docs/composables/fieldArray.md +104 -0
- package/dist/docs/composables/file.md +343 -0
- package/dist/docs/composables/focusTrap.md +87 -0
- package/dist/docs/composables/formPersistence.md +69 -0
- package/dist/docs/composables/formState.md +71 -0
- package/dist/docs/composables/formValidation.md +355 -0
- package/dist/docs/composables/format.md +107 -0
- package/dist/docs/composables/id.md +54 -0
- package/dist/docs/composables/index.md +112 -0
- package/dist/docs/composables/infiniteQuery.md +104 -0
- package/dist/docs/composables/intersectionObserver.md +64 -0
- package/dist/docs/composables/lazyQuery.md +68 -0
- package/dist/docs/composables/loading.md +91 -0
- package/dist/docs/composables/mutation.md +83 -0
- package/dist/docs/composables/notification.md +169 -0
- package/dist/docs/composables/pagination.md +109 -0
- package/dist/docs/composables/polling.md +76 -0
- package/dist/docs/composables/previous.md +58 -0
- package/dist/docs/composables/query.md +248 -0
- package/dist/docs/composables/raf.md +78 -0
- package/dist/docs/composables/scrollLock.md +46 -0
- package/dist/docs/composables/scrollToError.md +291 -0
- package/dist/docs/composables/scrollVisibility.md +60 -0
- package/dist/docs/composables/share.md +78 -0
- package/dist/docs/composables/slug.md +58 -0
- package/dist/docs/composables/stepper.md +117 -0
- package/dist/docs/composables/stepperForm.md +74 -0
- package/dist/docs/composables/sticky.md +91 -0
- package/dist/docs/composables/storage.md +193 -0
- package/dist/docs/composables/theme.md +252 -0
- package/dist/docs/composables/themePreset.md +62 -0
- package/dist/docs/composables/throttle.md +76 -0
- package/dist/docs/composables/timer.md +78 -0
- package/dist/docs/composables/toggle.md +55 -0
- package/dist/docs/guide/contributing.md +364 -0
- package/dist/docs/guide/design-tokens.md +29 -0
- package/dist/docs/guide/getting-started.md +181 -0
- package/dist/docs/guide/installation.md +287 -0
- package/dist/docs/guide/localization.md +132 -0
- package/dist/docs/guide/mcp.md +141 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +177 -0
- package/package.json +48 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
# Input
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-input` component with full v-model support and TypeScript types. Supports text, email, password, number, date, time, and other input types with validation, help text, loading state, and icons.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
Use `v-model` for two-way binding. Set `label` and `placeholder` for accessibility and UX.
|
|
8
|
+
|
|
9
|
+
<div class="component-demo">
|
|
10
|
+
|
|
11
|
+
<InputBasicDemo />
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<BvInput v-model="value" label="Email" placeholder="Enter your email" />
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import { ref } from "vue";
|
|
22
|
+
import { BvInput } from "@baklavue/ui";
|
|
23
|
+
|
|
24
|
+
const value = ref("");
|
|
25
|
+
</script>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Input Types
|
|
29
|
+
|
|
30
|
+
The Input component supports all standard HTML input types: text, email, password, number, date, time, and more.
|
|
31
|
+
|
|
32
|
+
<div class="component-demo">
|
|
33
|
+
|
|
34
|
+
<InputTypesDemo />
|
|
35
|
+
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
```vue
|
|
39
|
+
<template>
|
|
40
|
+
<BvInput v-model="text" type="text" label="Text" />
|
|
41
|
+
<BvInput v-model="email" type="email" label="Email" />
|
|
42
|
+
<BvInput v-model="password" type="password" label="Password" />
|
|
43
|
+
<BvInput v-model="number" type="number" label="Number" />
|
|
44
|
+
<BvInput v-model="date" type="date" label="Date" />
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup>
|
|
48
|
+
import { ref } from "vue";
|
|
49
|
+
import { BvInput } from "@baklavue/ui";
|
|
50
|
+
|
|
51
|
+
const text = ref("");
|
|
52
|
+
const email = ref("");
|
|
53
|
+
const password = ref("");
|
|
54
|
+
const number = ref(0);
|
|
55
|
+
const date = ref("");
|
|
56
|
+
</script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Validation
|
|
60
|
+
|
|
61
|
+
Use the `required` prop and native validation attributes (`minlength`, `maxlength`, `pattern`, etc.). Listen to the `invalid` event to handle validation failures and display custom error messages via the `invalid-text` prop.
|
|
62
|
+
|
|
63
|
+
<div class="component-demo">
|
|
64
|
+
|
|
65
|
+
<InputValidationDemo />
|
|
66
|
+
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
```vue
|
|
70
|
+
<template>
|
|
71
|
+
<BvInput
|
|
72
|
+
v-model="email"
|
|
73
|
+
type="email"
|
|
74
|
+
label="Email"
|
|
75
|
+
required
|
|
76
|
+
:invalid-text="emailError"
|
|
77
|
+
@invalid="handleInvalid"
|
|
78
|
+
/>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script setup>
|
|
82
|
+
import { ref } from "vue";
|
|
83
|
+
import { BvInput } from "@baklavue/ui";
|
|
84
|
+
|
|
85
|
+
const email = ref("");
|
|
86
|
+
const emailError = ref("");
|
|
87
|
+
|
|
88
|
+
const handleInvalid = (validity: ValidityState) => {
|
|
89
|
+
if (validity.typeMismatch) {
|
|
90
|
+
emailError.value = "Please enter a valid email address";
|
|
91
|
+
} else if (validity.valueMissing) {
|
|
92
|
+
emailError.value = "Email is required";
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
</script>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Help Text
|
|
99
|
+
|
|
100
|
+
Use the `help-text` prop to display helper text below the input.
|
|
101
|
+
|
|
102
|
+
<div class="component-demo">
|
|
103
|
+
|
|
104
|
+
<InputHelpTextDemo />
|
|
105
|
+
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
```vue
|
|
109
|
+
<template>
|
|
110
|
+
<BvInput
|
|
111
|
+
v-model="password"
|
|
112
|
+
type="password"
|
|
113
|
+
label="Password"
|
|
114
|
+
help-text="Must be at least 8 characters"
|
|
115
|
+
/>
|
|
116
|
+
</template>
|
|
117
|
+
|
|
118
|
+
<script setup>
|
|
119
|
+
import { ref } from "vue";
|
|
120
|
+
import { BvInput } from "@baklavue/ui";
|
|
121
|
+
|
|
122
|
+
const password = ref("");
|
|
123
|
+
</script>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Loading State
|
|
127
|
+
|
|
128
|
+
Use the `loading` prop to show a loading indicator while the input is processing (e.g. search-as-you-type).
|
|
129
|
+
|
|
130
|
+
<div class="component-demo">
|
|
131
|
+
|
|
132
|
+
<InputLoadingDemo />
|
|
133
|
+
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
```vue
|
|
137
|
+
<template>
|
|
138
|
+
<BvInput
|
|
139
|
+
v-model="search"
|
|
140
|
+
label="Search"
|
|
141
|
+
:loading="isSearching"
|
|
142
|
+
placeholder="Type to search..."
|
|
143
|
+
/>
|
|
144
|
+
</template>
|
|
145
|
+
|
|
146
|
+
<script setup>
|
|
147
|
+
import { ref } from "vue";
|
|
148
|
+
import { BvInput } from "@baklavue/ui";
|
|
149
|
+
|
|
150
|
+
const search = ref("");
|
|
151
|
+
const isSearching = ref(true);
|
|
152
|
+
</script>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Disabled and Readonly
|
|
156
|
+
|
|
157
|
+
Disable or set the input to readonly to prevent user interaction.
|
|
158
|
+
|
|
159
|
+
<div class="component-demo">
|
|
160
|
+
|
|
161
|
+
<InputDisabledReadonlyDemo />
|
|
162
|
+
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
```vue
|
|
166
|
+
<template>
|
|
167
|
+
<BvInput v-model="value" label="Disabled" disabled />
|
|
168
|
+
<BvInput v-model="value" label="Readonly" readonly />
|
|
169
|
+
</template>
|
|
170
|
+
|
|
171
|
+
<script setup>
|
|
172
|
+
import { ref } from "vue";
|
|
173
|
+
import { BvInput } from "@baklavue/ui";
|
|
174
|
+
|
|
175
|
+
const value = ref("Read-only value");
|
|
176
|
+
</script>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Sizes
|
|
180
|
+
|
|
181
|
+
Use the `size` prop to control the input height. Options: `small`, `medium` (default), `large`.
|
|
182
|
+
|
|
183
|
+
<div class="component-demo">
|
|
184
|
+
|
|
185
|
+
<InputSizesDemo />
|
|
186
|
+
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
```vue
|
|
190
|
+
<template>
|
|
191
|
+
<BvInput v-model="small" size="small" label="Small" />
|
|
192
|
+
<BvInput v-model="medium" size="medium" label="Medium" />
|
|
193
|
+
<BvInput v-model="large" size="large" label="Large" />
|
|
194
|
+
</template>
|
|
195
|
+
|
|
196
|
+
<script setup>
|
|
197
|
+
import { ref } from "vue";
|
|
198
|
+
import { BvInput } from "@baklavue/ui";
|
|
199
|
+
|
|
200
|
+
const small = ref("");
|
|
201
|
+
const medium = ref("");
|
|
202
|
+
const large = ref("");
|
|
203
|
+
</script>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## With Icon
|
|
207
|
+
|
|
208
|
+
Add an icon to the input using the `icon` prop. Use any Baklava icon name.
|
|
209
|
+
|
|
210
|
+
<div class="component-demo">
|
|
211
|
+
|
|
212
|
+
<InputWithIconDemo />
|
|
213
|
+
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
```vue
|
|
217
|
+
<template>
|
|
218
|
+
<BvInput v-model="search" label="Search" icon="search" />
|
|
219
|
+
</template>
|
|
220
|
+
|
|
221
|
+
<script setup>
|
|
222
|
+
import { ref } from "vue";
|
|
223
|
+
import { BvInput } from "@baklavue/ui";
|
|
224
|
+
|
|
225
|
+
const search = ref("");
|
|
226
|
+
</script>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Complete Example: Form with Validation
|
|
230
|
+
|
|
231
|
+
A complete form using multiple inputs with validation, help text, and error handling.
|
|
232
|
+
|
|
233
|
+
<div class="component-demo">
|
|
234
|
+
|
|
235
|
+
<InputFormValidationDemo />
|
|
236
|
+
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
```vue
|
|
240
|
+
<template>
|
|
241
|
+
<form @submit.prevent="handleSubmit">
|
|
242
|
+
<BvInput
|
|
243
|
+
v-model="form.email"
|
|
244
|
+
type="email"
|
|
245
|
+
label="Email"
|
|
246
|
+
required
|
|
247
|
+
:invalid-text="errors.email"
|
|
248
|
+
@invalid="handleEmailInvalid"
|
|
249
|
+
/>
|
|
250
|
+
<BvInput
|
|
251
|
+
v-model="form.password"
|
|
252
|
+
type="password"
|
|
253
|
+
label="Password"
|
|
254
|
+
required
|
|
255
|
+
:minlength="8"
|
|
256
|
+
:invalid-text="errors.password"
|
|
257
|
+
help-text="Must be at least 8 characters"
|
|
258
|
+
@invalid="handlePasswordInvalid"
|
|
259
|
+
/>
|
|
260
|
+
<BvButton type="submit">Submit</BvButton>
|
|
261
|
+
</form>
|
|
262
|
+
</template>
|
|
263
|
+
|
|
264
|
+
<script setup>
|
|
265
|
+
import { ref } from "vue";
|
|
266
|
+
import { BvInput, BvButton } from "@baklavue/ui";
|
|
267
|
+
|
|
268
|
+
const form = ref({
|
|
269
|
+
email: "",
|
|
270
|
+
password: "",
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
const errors = ref({
|
|
274
|
+
email: "",
|
|
275
|
+
password: "",
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
const handleEmailInvalid = (validity: ValidityState) => {
|
|
279
|
+
if (validity.typeMismatch) {
|
|
280
|
+
errors.value.email = "Please enter a valid email";
|
|
281
|
+
} else if (validity.valueMissing) {
|
|
282
|
+
errors.value.email = "Email is required";
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const handlePasswordInvalid = (validity: ValidityState) => {
|
|
287
|
+
if (validity.tooShort) {
|
|
288
|
+
errors.value.password = "Password must be at least 8 characters";
|
|
289
|
+
} else if (validity.valueMissing) {
|
|
290
|
+
errors.value.password = "Password is required";
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const handleSubmit = () => {
|
|
295
|
+
console.log("Form submitted:", form.value);
|
|
296
|
+
};
|
|
297
|
+
</script>
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Props
|
|
301
|
+
|
|
302
|
+
| Prop | Type | Default | Description |
|
|
303
|
+
| -------------- | -------------------------- | ----------- | ------------------------------------------------------ |
|
|
304
|
+
| `modelValue` | `string \| number \| null` | `undefined` | Input value (v-model) |
|
|
305
|
+
| `name` | `string` | `undefined` | Input name attribute |
|
|
306
|
+
| `type` | `InputType` | `'text'` | Input type (text, email, password, number, date, etc.) |
|
|
307
|
+
| `label` | `string` | `undefined` | Input label |
|
|
308
|
+
| `placeholder` | `string` | `undefined` | Placeholder text |
|
|
309
|
+
| `required` | `boolean` | `undefined` | Required field |
|
|
310
|
+
| `minlength` | `number` | `undefined` | Minimum length |
|
|
311
|
+
| `maxlength` | `number` | `undefined` | Maximum length |
|
|
312
|
+
| `min` | `number \| string` | `undefined` | Minimum value |
|
|
313
|
+
| `max` | `number \| string` | `undefined` | Maximum value |
|
|
314
|
+
| `pattern` | `string` | `undefined` | Validation pattern |
|
|
315
|
+
| `step` | `number` | `undefined` | Step value for number inputs |
|
|
316
|
+
| `autocomplete` | `string` | `undefined` | Autocomplete attribute |
|
|
317
|
+
| `inputmode` | `InputMode` | `undefined` | Input mode hint |
|
|
318
|
+
| `autofocus` | `boolean` | `undefined` | Autofocus attribute |
|
|
319
|
+
| `icon` | `BaklavaIcon` | `undefined` | Icon name |
|
|
320
|
+
| `size` | `InputSize` | `'medium'` | Input size (small, medium, large) |
|
|
321
|
+
| `disabled` | `boolean` | `undefined` | Disabled state |
|
|
322
|
+
| `readonly` | `boolean` | `undefined` | Readonly state |
|
|
323
|
+
| `labelFixed` | `boolean` | `true` | Fixed label position |
|
|
324
|
+
| `invalidText` | `string` | `undefined` | Error message text |
|
|
325
|
+
| `helpText` | `string` | `undefined` | Help text below input |
|
|
326
|
+
| `loading` | `boolean` | `undefined` | Loading state |
|
|
327
|
+
| `suffixText` | `string` | `undefined` | Suffix text in icon slot |
|
|
328
|
+
|
|
329
|
+
## Events
|
|
330
|
+
|
|
331
|
+
| Event | Payload | Description |
|
|
332
|
+
| ------------------- | -------------------------- | ----------------------------- |
|
|
333
|
+
| `update:modelValue` | `string \| number \| null` | Emitted when value changes |
|
|
334
|
+
| `invalid` | `ValidityState` | Emitted when validation fails |
|
|
335
|
+
| `focus` | `FocusEvent` | Emitted on focus |
|
|
336
|
+
| `blur` | `FocusEvent` | Emitted on blur |
|
|
337
|
+
|
|
338
|
+
## Slots
|
|
339
|
+
|
|
340
|
+
| Slot | Description |
|
|
341
|
+
| ------ | ------------------------------------------- |
|
|
342
|
+
| `icon` | Custom icon content (overrides `icon` prop) |
|
|
343
|
+
|
|
344
|
+
## Types
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
import type { InputProps } from "@baklavue/ui";
|
|
348
|
+
|
|
349
|
+
interface InputProps {
|
|
350
|
+
modelValue?: string | number | null;
|
|
351
|
+
name?: string;
|
|
352
|
+
type?:
|
|
353
|
+
| "text"
|
|
354
|
+
| "email"
|
|
355
|
+
| "password"
|
|
356
|
+
| "number"
|
|
357
|
+
| "date"
|
|
358
|
+
| "time"
|
|
359
|
+
| "datetime-local"
|
|
360
|
+
| "month"
|
|
361
|
+
| "week"
|
|
362
|
+
| "url"
|
|
363
|
+
| "tel"
|
|
364
|
+
| "search";
|
|
365
|
+
label?: string;
|
|
366
|
+
placeholder?: string;
|
|
367
|
+
required?: boolean;
|
|
368
|
+
minlength?: number;
|
|
369
|
+
maxlength?: number;
|
|
370
|
+
min?: number | string;
|
|
371
|
+
max?: number | string;
|
|
372
|
+
pattern?: string;
|
|
373
|
+
step?: number;
|
|
374
|
+
autocomplete?: string;
|
|
375
|
+
inputmode?:
|
|
376
|
+
| "none"
|
|
377
|
+
| "text"
|
|
378
|
+
| "decimal"
|
|
379
|
+
| "numeric"
|
|
380
|
+
| "tel"
|
|
381
|
+
| "search"
|
|
382
|
+
| "email"
|
|
383
|
+
| "url";
|
|
384
|
+
autofocus?: boolean;
|
|
385
|
+
icon?: string;
|
|
386
|
+
size?: "small" | "medium" | "large";
|
|
387
|
+
disabled?: boolean;
|
|
388
|
+
readonly?: boolean;
|
|
389
|
+
labelFixed?: boolean;
|
|
390
|
+
invalidText?: string;
|
|
391
|
+
helpText?: string;
|
|
392
|
+
loading?: boolean;
|
|
393
|
+
suffixText?: string;
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
## Usage Notes
|
|
398
|
+
|
|
399
|
+
- **Two-way binding**: Use `v-model` to bind the input value. The component emits `update:modelValue` when the value changes.
|
|
400
|
+
|
|
401
|
+
- **Validation flow**: Listen to the `invalid` event to handle validation failures. Set `invalid-text` reactively based on the `ValidityState` to display custom error messages.
|
|
402
|
+
|
|
403
|
+
- **Date/time picker**: For inputs with `type="date"`, `type="time"`, or `type="datetime-local"`, clicking the input triggers the native date/time picker.
|
|
404
|
+
|
|
405
|
+
- **Accessibility**: The component follows Baklava's accessibility guidelines and includes proper ARIA attributes for screen readers.
|
|
406
|
+
|
|
407
|
+
- **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,249 @@
|
|
|
1
|
+
# Link
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-link` component for navigation links. Supports inline (text within content) and standalone (button-like) variants with full TypeScript support.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
<div class="component-demo">
|
|
8
|
+
|
|
9
|
+
<LinkBasicDemo />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<BvLink href="/about">About</BvLink>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup>
|
|
19
|
+
import { BvLink } from "@baklavue/ui";
|
|
20
|
+
</script>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Variants
|
|
24
|
+
|
|
25
|
+
The Link component supports two variants: `inline` (default) for text within content, and `standalone` for button-like links.
|
|
26
|
+
|
|
27
|
+
### Inline Variant
|
|
28
|
+
|
|
29
|
+
Use the inline variant for links within paragraphs or other text content.
|
|
30
|
+
|
|
31
|
+
<div class="component-demo">
|
|
32
|
+
|
|
33
|
+
<LinkInlineDemo />
|
|
34
|
+
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<template>
|
|
39
|
+
<p>
|
|
40
|
+
Visit our <BvLink href="/docs">documentation</BvLink> for more information.
|
|
41
|
+
</p>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup>
|
|
45
|
+
import { BvLink } from "@baklavue/ui";
|
|
46
|
+
</script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Standalone Variant
|
|
50
|
+
|
|
51
|
+
Use the standalone variant for prominent, button-like links.
|
|
52
|
+
|
|
53
|
+
<div class="component-demo">
|
|
54
|
+
|
|
55
|
+
<LinkStandaloneDemo />
|
|
56
|
+
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
```vue
|
|
60
|
+
<template>
|
|
61
|
+
<BvLink href="/signup" variant="standalone">Sign up</BvLink>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script setup>
|
|
65
|
+
import { BvLink } from "@baklavue/ui";
|
|
66
|
+
</script>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Sizes
|
|
70
|
+
|
|
71
|
+
When using the standalone variant, the `size` prop controls the link size. Accepts `"small"`, `"medium"` (default), or `"large"`.
|
|
72
|
+
|
|
73
|
+
<div class="component-demo" style="display: flex; gap: 1rem; align-items: center; flex-wrap: wrap">
|
|
74
|
+
|
|
75
|
+
<LinkSizesDemo />
|
|
76
|
+
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
```vue
|
|
80
|
+
<template>
|
|
81
|
+
<BvLink href="/" variant="standalone" size="small">Small</BvLink>
|
|
82
|
+
<BvLink href="/" variant="standalone" size="medium">Medium</BvLink>
|
|
83
|
+
<BvLink href="/" variant="standalone" size="large">Large</BvLink>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script setup>
|
|
87
|
+
import { BvLink } from "@baklavue/ui";
|
|
88
|
+
</script>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Kind
|
|
92
|
+
|
|
93
|
+
When using the standalone variant, the `kind` prop controls the link style. Accepts `"primary"` (default) or `"neutral"`.
|
|
94
|
+
|
|
95
|
+
<div class="component-demo" style="display: flex; gap: 1rem; align-items: center; flex-wrap: wrap">
|
|
96
|
+
|
|
97
|
+
<BvLink href="/" variant="standalone" kind="primary">Primary</BvLink>
|
|
98
|
+
<BvLink href="/" variant="standalone" kind="neutral">Neutral</BvLink>
|
|
99
|
+
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
```vue
|
|
103
|
+
<template>
|
|
104
|
+
<BvLink href="/" variant="standalone" kind="primary">Primary</BvLink>
|
|
105
|
+
<BvLink href="/" variant="standalone" kind="neutral">Neutral</BvLink>
|
|
106
|
+
</template>
|
|
107
|
+
|
|
108
|
+
<script setup>
|
|
109
|
+
import { BvLink } from "@baklavue/ui";
|
|
110
|
+
</script>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## With Icon
|
|
114
|
+
|
|
115
|
+
Add an icon to the link using the `#icon` slot. The icon slot is typically used with the standalone variant.
|
|
116
|
+
|
|
117
|
+
<div class="component-demo">
|
|
118
|
+
|
|
119
|
+
<LinkWithIconDemo />
|
|
120
|
+
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
```vue
|
|
124
|
+
<template>
|
|
125
|
+
<BvLink href="/settings" variant="standalone">
|
|
126
|
+
<template #icon><BvIcon name="settings" /></template>
|
|
127
|
+
Settings
|
|
128
|
+
</BvLink>
|
|
129
|
+
</template>
|
|
130
|
+
|
|
131
|
+
<script setup>
|
|
132
|
+
import { BvLink, BvIcon } from "@baklavue/ui";
|
|
133
|
+
</script>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Disabled State
|
|
137
|
+
|
|
138
|
+
Disable a link to prevent user interaction.
|
|
139
|
+
|
|
140
|
+
<div class="component-demo">
|
|
141
|
+
|
|
142
|
+
<LinkDisabledDemo />
|
|
143
|
+
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
```vue
|
|
147
|
+
<template>
|
|
148
|
+
<BvLink href="/disabled" :disabled="true">Disabled link</BvLink>
|
|
149
|
+
</template>
|
|
150
|
+
|
|
151
|
+
<script setup>
|
|
152
|
+
import { BvLink } from "@baklavue/ui";
|
|
153
|
+
</script>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## External Links
|
|
157
|
+
|
|
158
|
+
Use the `target` and `rel` props for external links. Set `target="_blank"` to open in a new tab and `rel="noopener noreferrer"` for security.
|
|
159
|
+
|
|
160
|
+
<div class="component-demo">
|
|
161
|
+
|
|
162
|
+
<LinkExternalDemo />
|
|
163
|
+
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
```vue
|
|
167
|
+
<template>
|
|
168
|
+
<BvLink
|
|
169
|
+
href="https://github.com/erbilnas/baklavue"
|
|
170
|
+
target="_blank"
|
|
171
|
+
rel="noopener noreferrer"
|
|
172
|
+
>
|
|
173
|
+
Open GitHub
|
|
174
|
+
</BvLink>
|
|
175
|
+
</template>
|
|
176
|
+
|
|
177
|
+
<script setup>
|
|
178
|
+
import { BvLink } from "@baklavue/ui";
|
|
179
|
+
</script>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Props
|
|
183
|
+
|
|
184
|
+
| Prop | Type | Default | Description |
|
|
185
|
+
| ---------------- | ----------- | ----------- | ---------------------------------------------------------------------- |
|
|
186
|
+
| `href` | `string` | `undefined` | URL that the hyperlink points to |
|
|
187
|
+
| `target` | `string` | `undefined` | Where to display the linked URL (e.g. `"_self"`, `"_blank"`) |
|
|
188
|
+
| `disabled` | `boolean` | `undefined` | Whether the link is disabled |
|
|
189
|
+
| `variant` | `LinkVariant` | `undefined` | Link variant - `"inline"` or `"standalone"` |
|
|
190
|
+
| `size` | `LinkSize` | `undefined` | Link size - only applies to standalone variant |
|
|
191
|
+
| `kind` | `LinkKind` | `undefined` | Link kind - only applies to standalone variant |
|
|
192
|
+
| `ariaLabel` | `string` | `undefined` | Aria label for accessibility |
|
|
193
|
+
| `rel` | `string` | `undefined` | Relationship (e.g. `"noopener noreferrer"` for external links) |
|
|
194
|
+
| `hreflang` | `string` | `undefined` | Language of the linked document |
|
|
195
|
+
| `type` | `string` | `undefined` | MIME type of the linked document |
|
|
196
|
+
| `referrerPolicy` | `string` | `undefined` | Referrer policy for the link |
|
|
197
|
+
| `download` | `string` | `undefined` | Whether to download the resource instead of navigating |
|
|
198
|
+
| `ping` | `string` | `undefined` | Ping URLs to be notified when following the link |
|
|
199
|
+
|
|
200
|
+
## Events
|
|
201
|
+
|
|
202
|
+
| Event | Payload | Description |
|
|
203
|
+
| ------- | ------------ | ------------------------------ |
|
|
204
|
+
| `click` | `CustomEvent` | Emitted when the link is clicked |
|
|
205
|
+
|
|
206
|
+
## Slots
|
|
207
|
+
|
|
208
|
+
| Slot | Props | Description |
|
|
209
|
+
| --------- | ----- | -------------------------------------------- |
|
|
210
|
+
| `default` | - | Link text content |
|
|
211
|
+
| `icon` | - | Custom icon for non-standalone variants |
|
|
212
|
+
|
|
213
|
+
## Types
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import type { LinkProps, LinkVariant, LinkSize, LinkKind } from "@baklavue/ui";
|
|
217
|
+
|
|
218
|
+
type LinkVariant = "inline" | "standalone";
|
|
219
|
+
type LinkSize = "small" | "medium" | "large";
|
|
220
|
+
type LinkKind = "primary" | "neutral";
|
|
221
|
+
|
|
222
|
+
interface LinkProps {
|
|
223
|
+
href?: string;
|
|
224
|
+
target?: string;
|
|
225
|
+
disabled?: boolean;
|
|
226
|
+
variant?: LinkVariant;
|
|
227
|
+
size?: LinkSize;
|
|
228
|
+
kind?: LinkKind;
|
|
229
|
+
ariaLabel?: string;
|
|
230
|
+
rel?: string;
|
|
231
|
+
hreflang?: string;
|
|
232
|
+
type?: string;
|
|
233
|
+
referrerPolicy?: string;
|
|
234
|
+
download?: string;
|
|
235
|
+
ping?: string;
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Usage Notes
|
|
240
|
+
|
|
241
|
+
- **Inline vs Standalone**: Use `inline` (default) for links within text content. Use `standalone` for prominent, button-like links that stand alone.
|
|
242
|
+
|
|
243
|
+
- **Size and Kind**: The `size` and `kind` props only apply when `variant="standalone"`.
|
|
244
|
+
|
|
245
|
+
- **External Links**: When using `target="_blank"`, always add `rel="noopener noreferrer"` for security.
|
|
246
|
+
|
|
247
|
+
- **Accessibility**: Use the `ariaLabel` prop when the link text alone does not provide sufficient context for screen readers.
|
|
248
|
+
|
|
249
|
+
- **Styling**: The component uses Baklava's default styling. Custom styling can be applied through CSS variables: `--bl-link-color`, `--bl-link-hover-color`, `--bl-link-active-color`.
|