@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,233 @@
|
|
|
1
|
+
# Alert
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-alert` component for displaying alert messages.
|
|
4
|
+
|
|
5
|
+
## Basic Alert
|
|
6
|
+
|
|
7
|
+
Use the Alert component with the `description` prop for simple alert messages.
|
|
8
|
+
|
|
9
|
+
<div class="component-demo">
|
|
10
|
+
|
|
11
|
+
<BvAlert variant="info" description="This is an info alert" />
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<BvAlert variant="info" description="This is an info alert" />
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import { BvAlert } from "@baklavue/ui";
|
|
22
|
+
</script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Variants
|
|
26
|
+
|
|
27
|
+
The Alert component supports four variants: info, success, warning, and danger.
|
|
28
|
+
|
|
29
|
+
<div class="component-demo" style="display: flex; flex-direction: column; gap: 1rem">
|
|
30
|
+
|
|
31
|
+
<BvAlert variant="info" description="Info message" />
|
|
32
|
+
|
|
33
|
+
<BvAlert variant="success" description="Success message" />
|
|
34
|
+
|
|
35
|
+
<BvAlert variant="warning" description="Warning message" />
|
|
36
|
+
|
|
37
|
+
<BvAlert variant="danger" description="Danger message" />
|
|
38
|
+
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<template>
|
|
43
|
+
<BvAlert variant="info" description="Info message" />
|
|
44
|
+
<BvAlert variant="success" description="Success message" />
|
|
45
|
+
<BvAlert variant="warning" description="Warning message" />
|
|
46
|
+
<BvAlert variant="danger" description="Danger message" />
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup>
|
|
50
|
+
import { BvAlert } from "@baklavue/ui";
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## With Icon
|
|
55
|
+
|
|
56
|
+
Add an icon to the alert using the `icon` prop. Use a boolean to show the default variant icon, or pass a specific icon name.
|
|
57
|
+
|
|
58
|
+
<div class="component-demo" style="display: flex; flex-direction: column; gap: 1rem">
|
|
59
|
+
|
|
60
|
+
<BvAlert variant="info" description="Alert with default icon" :icon="true" />
|
|
61
|
+
<BvAlert variant="success" description="Alert with settings icon" icon="settings" />
|
|
62
|
+
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
```vue
|
|
66
|
+
<template>
|
|
67
|
+
<BvAlert variant="info" description="Alert with default icon" :icon="true" />
|
|
68
|
+
<BvAlert
|
|
69
|
+
variant="success"
|
|
70
|
+
description="Alert with settings icon"
|
|
71
|
+
icon="settings"
|
|
72
|
+
/>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script setup>
|
|
76
|
+
import { BvAlert } from "@baklavue/ui";
|
|
77
|
+
</script>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## With Caption
|
|
81
|
+
|
|
82
|
+
Add a caption (title) to the alert using the `caption` prop.
|
|
83
|
+
|
|
84
|
+
<div class="component-demo">
|
|
85
|
+
|
|
86
|
+
<BvAlert
|
|
87
|
+
variant="info"
|
|
88
|
+
caption="Important notice"
|
|
89
|
+
description="Please review the terms and conditions before proceeding."
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
```vue
|
|
95
|
+
<template>
|
|
96
|
+
<BvAlert
|
|
97
|
+
variant="info"
|
|
98
|
+
caption="Important notice"
|
|
99
|
+
description="Please review the terms and conditions before proceeding."
|
|
100
|
+
/>
|
|
101
|
+
</template>
|
|
102
|
+
|
|
103
|
+
<script setup>
|
|
104
|
+
import { BvAlert } from "@baklavue/ui";
|
|
105
|
+
</script>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Closable
|
|
109
|
+
|
|
110
|
+
Display a close button on the alert using the `closable` prop. Listen to the `close` event to handle when the user dismisses the alert.
|
|
111
|
+
|
|
112
|
+
<div class="component-demo">
|
|
113
|
+
|
|
114
|
+
<ClosableAlertDemo />
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
```vue
|
|
119
|
+
<template>
|
|
120
|
+
<BvAlert
|
|
121
|
+
variant="info"
|
|
122
|
+
description="This alert can be closed"
|
|
123
|
+
closable
|
|
124
|
+
@close="handleClose"
|
|
125
|
+
/>
|
|
126
|
+
</template>
|
|
127
|
+
|
|
128
|
+
<script setup>
|
|
129
|
+
import { BvAlert } from "@baklavue/ui";
|
|
130
|
+
|
|
131
|
+
const handleClose = () => {
|
|
132
|
+
console.log("Alert closed");
|
|
133
|
+
};
|
|
134
|
+
</script>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Custom Content with Slots
|
|
138
|
+
|
|
139
|
+
Use the `#default`, `#caption`, or `#action` slots to customize the alert content. The default slot provides custom content in place of the `description` prop. The caption slot overrides the `caption` prop. The action slot adds content to the action area.
|
|
140
|
+
|
|
141
|
+
<div class="component-demo">
|
|
142
|
+
|
|
143
|
+
<BvAlert variant="info" caption="Custom Slots">
|
|
144
|
+
<template #default>
|
|
145
|
+
<p style="color: black">This content is rendered via the default slot instead of the description prop.</p>
|
|
146
|
+
</template>
|
|
147
|
+
<template #action>
|
|
148
|
+
<BvButton size="small">Learn more</BvButton>
|
|
149
|
+
</template>
|
|
150
|
+
</BvAlert>
|
|
151
|
+
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
```vue
|
|
155
|
+
<template>
|
|
156
|
+
<BvAlert variant="info" caption="Custom Slots">
|
|
157
|
+
<template #default>
|
|
158
|
+
<p>
|
|
159
|
+
This content is rendered via the default slot instead of the description
|
|
160
|
+
prop.
|
|
161
|
+
</p>
|
|
162
|
+
</template>
|
|
163
|
+
<template #action>
|
|
164
|
+
<BvButton variant="tertiary" size="small">Learn more</BvButton>
|
|
165
|
+
</template>
|
|
166
|
+
</BvAlert>
|
|
167
|
+
</template>
|
|
168
|
+
|
|
169
|
+
<script setup>
|
|
170
|
+
import { BvAlert, BvButton } from "@baklavue/ui";
|
|
171
|
+
</script>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Props
|
|
175
|
+
|
|
176
|
+
| Prop | Type | Default | Description |
|
|
177
|
+
| ------------- | ------------------------ | ----------- | ------------------------------------------------------------------------ |
|
|
178
|
+
| `variant` | `AlertVariant` | `'info'` | Alert variant (info, success, warning, danger) |
|
|
179
|
+
| `description` | `string` | `undefined` | Alert message text |
|
|
180
|
+
| `icon` | `boolean \| BaklavaIcon` | `undefined` | Icon configuration - boolean to show default icon, or specific icon name |
|
|
181
|
+
| `closable` | `boolean` | `false` | Show close button |
|
|
182
|
+
| `caption` | `string` | `undefined` | Optional caption (title) for the alert |
|
|
183
|
+
| `closed` | `boolean` | `false` | Whether the alert is closed/hidden. Use with programmatic control. |
|
|
184
|
+
|
|
185
|
+
## Events
|
|
186
|
+
|
|
187
|
+
| Event | Payload | Description |
|
|
188
|
+
| ------- | ------- | ---------------------------------------- |
|
|
189
|
+
| `close` | `void` | Emitted when the close button is clicked |
|
|
190
|
+
|
|
191
|
+
## Methods
|
|
192
|
+
|
|
193
|
+
Access these methods via template refs:
|
|
194
|
+
|
|
195
|
+
| Method | Description |
|
|
196
|
+
| --------- | --------------------------------- |
|
|
197
|
+
| `open()` | Opens the alert programmatically |
|
|
198
|
+
| `close()` | Closes the alert programmatically |
|
|
199
|
+
|
|
200
|
+
## Slots
|
|
201
|
+
|
|
202
|
+
| Slot | Props | Description |
|
|
203
|
+
| --------- | ----- | -------------------------------------------------- |
|
|
204
|
+
| `default` | - | Custom content (alternative to `description` prop) |
|
|
205
|
+
| `caption` | - | Custom caption (alternative to `caption` prop) |
|
|
206
|
+
| `action` | - | Action area content (e.g. buttons, links) |
|
|
207
|
+
|
|
208
|
+
## Types
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
import type { AlertProps } from "@baklavue/ui";
|
|
212
|
+
|
|
213
|
+
// AlertVariant: "info" | "success" | "warning" | "danger"
|
|
214
|
+
|
|
215
|
+
interface AlertProps {
|
|
216
|
+
variant?: AlertVariant;
|
|
217
|
+
description?: string;
|
|
218
|
+
icon?: boolean | BaklavaIcon;
|
|
219
|
+
closable?: boolean;
|
|
220
|
+
caption?: string;
|
|
221
|
+
closed?: boolean;
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Usage Notes
|
|
226
|
+
|
|
227
|
+
- **Description vs Default Slot**: Use the `description` prop for simple text alerts. Use the `#default` slot when you need custom markup (e.g. links, formatted text, or multiple paragraphs).
|
|
228
|
+
|
|
229
|
+
- **Programmatic Control**: Use the `closed` prop to control visibility, and call `open()` or `close()` via a template ref. Sync state by listening to the `close` event when the user clicks the close button.
|
|
230
|
+
|
|
231
|
+
- **Accessibility**: The component follows Baklava's accessibility guidelines and includes proper ARIA attributes for screen readers.
|
|
232
|
+
|
|
233
|
+
- **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,100 @@
|
|
|
1
|
+
# Badge
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-badge` component for displaying status badges.
|
|
4
|
+
|
|
5
|
+
## Basic Badge
|
|
6
|
+
|
|
7
|
+
Use the Badge component with the default slot for simple badge content.
|
|
8
|
+
|
|
9
|
+
<div class="component-demo">
|
|
10
|
+
|
|
11
|
+
<BvBadge>New</BvBadge>
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<BvBadge>New</BvBadge>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import { BvBadge } from "@baklavue/ui";
|
|
22
|
+
</script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Sizes
|
|
26
|
+
|
|
27
|
+
The Badge component supports three sizes: small, medium, and large.
|
|
28
|
+
|
|
29
|
+
<div class="component-demo" style="display: flex; align-items: center; gap: 1rem; flex-wrap: wrap">
|
|
30
|
+
|
|
31
|
+
<BvBadge size="small">Small</BvBadge>
|
|
32
|
+
|
|
33
|
+
<BvBadge size="medium">Medium</BvBadge>
|
|
34
|
+
|
|
35
|
+
<BvBadge size="large">Large</BvBadge>
|
|
36
|
+
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<template>
|
|
41
|
+
<BvBadge size="small">Small</BvBadge>
|
|
42
|
+
<BvBadge size="medium">Medium</BvBadge>
|
|
43
|
+
<BvBadge size="large">Large</BvBadge>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup>
|
|
47
|
+
import { BvBadge } from "@baklavue/ui";
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## With Icon
|
|
52
|
+
|
|
53
|
+
Add an icon to the badge using the `icon` prop.
|
|
54
|
+
|
|
55
|
+
<div class="component-demo" style="display: flex; align-items: center; gap: 1rem; flex-wrap: wrap">
|
|
56
|
+
|
|
57
|
+
<BvBadge icon="notification">Updates</BvBadge>
|
|
58
|
+
|
|
59
|
+
<BvBadge icon="settings" size="small">Settings</BvBadge>
|
|
60
|
+
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
```vue
|
|
64
|
+
<template>
|
|
65
|
+
<BvBadge icon="notification">Updates</BvBadge>
|
|
66
|
+
<BvBadge icon="settings" size="small">Settings</BvBadge>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script setup>
|
|
70
|
+
import { BvBadge } from "@baklavue/ui";
|
|
71
|
+
</script>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Props
|
|
75
|
+
|
|
76
|
+
| Prop | Type | Default | Description |
|
|
77
|
+
| ------ | ------------------------ | ----------- | ---------------------------------- |
|
|
78
|
+
| `size` | `BadgeSize` | `'medium'` | Badge size (small, medium, large) |
|
|
79
|
+
| `icon` | `BaklavaIcon \| undefined` | `undefined` | Optional icon name for the badge |
|
|
80
|
+
|
|
81
|
+
## Types
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import type { BadgeProps } from "@baklavue/ui";
|
|
85
|
+
|
|
86
|
+
// BadgeSize: "small" | "medium" | "large"
|
|
87
|
+
|
|
88
|
+
interface BadgeProps {
|
|
89
|
+
size?: BadgeSize;
|
|
90
|
+
icon?: BaklavaIcon;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Usage Notes
|
|
95
|
+
|
|
96
|
+
- **Default Slot**: The badge content is provided via the default slot. Place text or simple content between the opening and closing tags.
|
|
97
|
+
|
|
98
|
+
- **Styling**: The component uses Baklava's default styling. Custom colors can be applied through CSS variables (`--bl-badge-bg-color`, `--bl-badge-color`) or by overriding the component styles.
|
|
99
|
+
|
|
100
|
+
- **Accessibility**: The component follows Baklava's accessibility guidelines and includes proper ARIA attributes for screen readers.
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Banner
|
|
2
|
+
|
|
3
|
+
A full-width banner displayed at the top of a page to inform users about important information.
|
|
4
|
+
|
|
5
|
+
## Basic
|
|
6
|
+
|
|
7
|
+
Use the `title` prop for a simple banner message.
|
|
8
|
+
|
|
9
|
+
<div class="component-demo">
|
|
10
|
+
|
|
11
|
+
<BannerBasicDemo />
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<BvBanner title="This is a banner with an important message." />
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import { BvBanner } from "@baklavue/ui";
|
|
22
|
+
</script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## With Icon
|
|
26
|
+
|
|
27
|
+
Add an icon next to the title using the `icon` prop.
|
|
28
|
+
|
|
29
|
+
<div class="component-demo">
|
|
30
|
+
|
|
31
|
+
<BannerWithIconDemo />
|
|
32
|
+
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
<template>
|
|
37
|
+
<BvBanner icon="info" title="This is a banner with an icon." />
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup>
|
|
41
|
+
import { BvBanner } from "@baklavue/ui";
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Color Variants
|
|
46
|
+
|
|
47
|
+
Use the `color` prop to change the banner color. Supports primary, success, danger, warning, info, and neutral.
|
|
48
|
+
|
|
49
|
+
<div class="component-demo" style="display: flex; flex-direction: column; gap: 0.5rem;">
|
|
50
|
+
|
|
51
|
+
<BannerColorsDemo />
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<template>
|
|
57
|
+
<BvBanner color="primary" title="Primary banner" />
|
|
58
|
+
<BvBanner color="success" title="Success banner" />
|
|
59
|
+
<BvBanner color="info" icon="info" title="Info banner" />
|
|
60
|
+
<BvBanner color="warning" icon="warning" title="Warning banner" />
|
|
61
|
+
<BvBanner color="danger" icon="danger" title="Danger banner" />
|
|
62
|
+
<BvBanner color="neutral" title="Neutral banner" />
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script setup>
|
|
66
|
+
import { BvBanner } from "@baklavue/ui";
|
|
67
|
+
</script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Closable
|
|
71
|
+
|
|
72
|
+
Display a close button using the `close` prop. Listen to the `close` event when the user dismisses the banner. Use the `id` prop to persist the dismissed state in localStorage across page reloads.
|
|
73
|
+
|
|
74
|
+
<div class="component-demo">
|
|
75
|
+
|
|
76
|
+
<BannerClosableDemo />
|
|
77
|
+
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
```vue
|
|
81
|
+
<template>
|
|
82
|
+
<BvBanner
|
|
83
|
+
id="example"
|
|
84
|
+
title="This is a closable banner."
|
|
85
|
+
close
|
|
86
|
+
@close="handleClose"
|
|
87
|
+
/>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<script setup>
|
|
91
|
+
import { BvBanner } from "@baklavue/ui";
|
|
92
|
+
|
|
93
|
+
const handleClose = () => {
|
|
94
|
+
console.log("Banner closed");
|
|
95
|
+
};
|
|
96
|
+
</script>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## With Actions
|
|
100
|
+
|
|
101
|
+
Use the `actions` prop to add action buttons to the banner.
|
|
102
|
+
|
|
103
|
+
<div class="component-demo">
|
|
104
|
+
|
|
105
|
+
<BannerWithActionsDemo />
|
|
106
|
+
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
```vue
|
|
110
|
+
<template>
|
|
111
|
+
<BvBanner title="This is a banner with actions." :actions="actions" />
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
<script setup>
|
|
115
|
+
import { ref } from "vue";
|
|
116
|
+
import { BvBanner } from "@baklavue/ui";
|
|
117
|
+
|
|
118
|
+
const actions = ref([
|
|
119
|
+
{
|
|
120
|
+
label: "Action 1",
|
|
121
|
+
variant: "tertiary",
|
|
122
|
+
onClick: () => console.log("Action 1"),
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: "Action 2",
|
|
126
|
+
variant: "tertiary",
|
|
127
|
+
trailingIcon: "arrow_right",
|
|
128
|
+
onClick: () => console.log("Action 2"),
|
|
129
|
+
},
|
|
130
|
+
]);
|
|
131
|
+
</script>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## As Link
|
|
135
|
+
|
|
136
|
+
Pass the `to` prop to make the banner a link. Useful for announcements that link to more information.
|
|
137
|
+
|
|
138
|
+
<div class="component-demo">
|
|
139
|
+
|
|
140
|
+
<BannerLinkDemo />
|
|
141
|
+
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
```vue
|
|
145
|
+
<template>
|
|
146
|
+
<BvBanner
|
|
147
|
+
to="https://example.com"
|
|
148
|
+
target="_blank"
|
|
149
|
+
title="Learn more about our announcement"
|
|
150
|
+
color="primary"
|
|
151
|
+
/>
|
|
152
|
+
</template>
|
|
153
|
+
|
|
154
|
+
<script setup>
|
|
155
|
+
import { BvBanner } from "@baklavue/ui";
|
|
156
|
+
</script>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Usage in App Layout
|
|
160
|
+
|
|
161
|
+
Use the Banner at the top of your app layout or main template.
|
|
162
|
+
|
|
163
|
+
```vue
|
|
164
|
+
<template>
|
|
165
|
+
<div class="app">
|
|
166
|
+
<BvBanner
|
|
167
|
+
icon="info"
|
|
168
|
+
title="Important announcement: Check out our new features!"
|
|
169
|
+
close
|
|
170
|
+
id="announcement-2024"
|
|
171
|
+
/>
|
|
172
|
+
<header>...</header>
|
|
173
|
+
<main>...</main>
|
|
174
|
+
</div>
|
|
175
|
+
</template>
|
|
176
|
+
|
|
177
|
+
<script setup>
|
|
178
|
+
import { BvBanner } from "@baklavue/ui";
|
|
179
|
+
</script>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Props
|
|
183
|
+
|
|
184
|
+
| Prop | Type | Default | Description |
|
|
185
|
+
| ----------- | ---------------- | ----------- | ----------------------------------------------------------------- |
|
|
186
|
+
| `title` | `string` | - | Banner message text |
|
|
187
|
+
| `icon` | `BaklavaIcon` | - | Icon name displayed next to the title |
|
|
188
|
+
| `color` | `BannerColor` | `'primary'` | Color variant (primary, success, danger, warning, info, neutral) |
|
|
189
|
+
| `close` | `boolean` | `false` | Show close button |
|
|
190
|
+
| `closeIcon` | `BaklavaIcon` | `'close'` | Icon for the close button |
|
|
191
|
+
| `id` | `string` | - | Unique ID for localStorage persistence (stores as `banner-${id}`) |
|
|
192
|
+
| `to` | `string` | - | Makes the banner a link (href) |
|
|
193
|
+
| `target` | `string` | - | Link target (e.g. `_blank`) |
|
|
194
|
+
| `actions` | `BannerAction[]` | - | Action buttons (label, variant, onClick, icon, trailingIcon) |
|
|
195
|
+
|
|
196
|
+
## Events
|
|
197
|
+
|
|
198
|
+
| Event | Payload | Description |
|
|
199
|
+
| ------- | ------- | ---------------------------------------- |
|
|
200
|
+
| `close` | `void` | Emitted when the close button is clicked |
|
|
201
|
+
|
|
202
|
+
## Slots
|
|
203
|
+
|
|
204
|
+
| Slot | Props | Description |
|
|
205
|
+
| --------- | ----- | ------------------------------- |
|
|
206
|
+
| `leading` | - | Custom content before the title |
|
|
207
|
+
| `title` | - | Override title content |
|
|
208
|
+
| `actions` | - | Custom action buttons |
|
|
209
|
+
| `close` | - | Custom close button |
|
|
210
|
+
|
|
211
|
+
## Types
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import type { BannerProps, BannerColor, BannerAction } from "@baklavue/ui";
|
|
215
|
+
|
|
216
|
+
const props: BannerProps = {
|
|
217
|
+
title: "Banner message",
|
|
218
|
+
icon: "info",
|
|
219
|
+
color: "primary",
|
|
220
|
+
close: false,
|
|
221
|
+
actions: [{ label: "Learn more", variant: "tertiary", onClick: () => {} }],
|
|
222
|
+
};
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Usage Notes
|
|
226
|
+
|
|
227
|
+
- **localStorage persistence**: When `id` is set and `close` is true, the dismissed state is stored in localStorage as `banner-${id}`. The banner will not show again until the user clears storage or the key is removed.
|
|
228
|
+
|
|
229
|
+
- **Link mode**: When `to` is provided, the banner content becomes a link. Action buttons inside the banner will not trigger navigation (clicks are stopped).
|
|
230
|
+
|
|
231
|
+
- **Accessibility**: The component uses `role="banner"` and includes an accessible close button label.
|