@gecko-ui-kit/vue 0.0.0-stage → 0.3.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 CHANGED
@@ -1,3 +1,2053 @@
1
- # Temporary Holding Version
1
+ # @gecko-ui-kit/vue
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Every [Gecko UI Kit](https://woraphondev.github.io/UI-Package/playground/) piece as a Vue 3 component: buttons, forms,
4
+ pickers, data display, charts, text and scroll motion, overlays and the app shell. Made for Nuxt: every component
5
+ renders on the server and wakes up in the browser, and comes with TypeScript types.
6
+
7
+ ```bash
8
+ npm install gsap @gecko-ui-kit/vue
9
+ ```
10
+ It brings the other Gecko packages with it. `vue` 3.5 or newer comes from your app.
11
+
12
+ ## Set up (Nuxt)
13
+
14
+ Load the CSS once, in this order, and register the components with a small plugin:
15
+
16
+ ```ts
17
+ // nuxt.config.ts
18
+ export default defineNuxtConfig({
19
+ css: [
20
+ '@gecko-ui-kit/tokens/style.css', // variables + small reset (first)
21
+ '@gecko-ui-kit/motion/motion.css',
22
+ '@gecko-ui-kit/components/style.css',
23
+ '@gecko-ui-kit/overlays/style.css',
24
+ '@gecko-ui-kit/shell/style.css', // only if you use the app shell
25
+ '~/assets/main.css', // your own styles last
26
+ ],
27
+ })
28
+ ```
29
+
30
+ ```ts
31
+ // plugins/gecko.ts
32
+ import { GeckoUI } from '@gecko-ui-kit/vue'
33
+ export default defineNuxtPlugin((nuxt) => {
34
+ nuxt.vueApp.use(GeckoUI) // <Button>, <Rating>, <Modal>… in every template
35
+ // nuxt.vueApp.use(GeckoUI, { prefix: 'G' }) // → <GButton>, <GRating>…
36
+ })
37
+ ```
38
+
39
+ Then use them in any page or component:
40
+
41
+ ```vue
42
+ <!-- pages/bikes.vue -->
43
+ <template>
44
+ <Card title="Honda Click 125" sub="Plate 1กข 1234">
45
+ <template #right><Tag tone="good">Available</Tag></template>
46
+ <Segmented v-model="view" :options="[['list', 'List', 'list'], ['calendar', 'Calendar', 'calendar']]" />
47
+ <Button variant="primary" icon="calendar" @click="open = true">Book</Button>
48
+ </Card>
49
+ <Modal v-model:open="open" title="Confirm booking">
50
+ <DateRange v-model="range" />
51
+ <template #footer><Button variant="primary" @click="book">Book</Button></template>
52
+ </Modal>
53
+ </template>
54
+
55
+ <script setup lang="ts">
56
+ import { ref } from 'vue'
57
+ import { toast } from '@gecko-ui-kit/vue'
58
+ const view = ref('list'), open = ref(false), range = ref(null)
59
+ function book() { open.value = false; toast('Booked!') }
60
+ </script>
61
+ ```
62
+
63
+ **Plain Vue (Vite):** import the same CSS files in `main.ts` and call `app.use(GeckoUI)`, or import each component
64
+ where you use it: `import { Button, Modal } from '@gecko-ui-kit/vue'`.
65
+
66
+ ## Fit it into an app that already has its own look
67
+
68
+ - **Nothing clashes.** Every class Gecko draws starts with `gk-` (`gk-btn`, `gk-card`, `gk-is-open`) and every CSS
69
+ variable with `--gk-` (`--gk-accent`), so your own `.btn`, `.card` or `--accent` keep working as before.
70
+ - **The reset stays inside Gecko.** `tokens/style.css` only resets Gecko's own elements; your `body`, links and buttons
71
+ are left alone. Want Gecko to set the page font, background and focus ring too? Add `@gecko-ui-kit/tokens/page.css`.
72
+ - **Match your theme** by setting variables after the imports (e.g. in `~/assets/main.css`):
73
+
74
+ ```css
75
+ :root {
76
+ --gk-font: 'Prompt', system-ui, sans-serif;
77
+ --gk-bg: #eef1f6; --gk-card: #ffffff; --gk-line: #e2e6ee; --gk-ink: #1a1a1a; --gk-muted: #595959;
78
+ --gk-accent: #006ce4; --gk-accent-2: #0057b8; --gk-accent-soft: #ebf3ff; /* main buttons, links, focus */
79
+ --gk-selected: #ffb700; --gk-selected-ink: #1a1a1a; /* the chosen segment, chip, tab line and page */
80
+ --gk-r-card: 14px; --gk-r-btn: 10px; --gk-r-field: 10px; --gk-r-tag: 6px; --gk-r-badge: 6px; --gk-r-pill: 10px;
81
+ --gk-w-strong: 500; --gk-w-semibold: 600; /* lighter buttons and labels */
82
+ }
83
+ ```
84
+ Corners: `--gk-r-btn`, `--gk-r-iconbtn`, `--gk-r-field`, `--gk-r-chip`, `--gk-r-check`, `--gk-r-tag`, `--gk-r-badge`,
85
+ `--gk-r-pill` (segmented), `--gk-r-card`, `--gk-r-kpi`, `--gk-r-pop`, `--gk-r-toast`. Weights: `--gk-w-light` 300,
86
+ `--gk-w-medium` 500, `--gk-w-label` 550, `--gk-w-semibold` 600, `--gk-w-strong` 650, `--gk-w-bold` 700, `--gk-w-heavy` 750,
87
+ `--gk-w-black` 800. `--gk-selected` / `--gk-selected-ink` are unset by default (each piece keeps its own look).
88
+
89
+ ## Phone apps (PWA, Capacitor)
90
+
91
+ The kit works in a phone app made from your Nuxt site: a PWA, or the site wrapped by Capacitor. Let the page run
92
+ under the notch and home bar, and the app frame, phone sheets, toasts and tab bar keep clear of them on their own:
93
+ ```js
94
+ // nuxt.config.ts
95
+ app: { head: { meta: [{ name: 'viewport', content: 'width=device-width, initial-scale=1, viewport-fit=cover' }] } }
96
+ ```
97
+ The room comes from `--gk-safe-t`, `--gk-safe-r`, `--gk-safe-b`, `--gk-safe-l` (0 on desktop); set them yourself if
98
+ your native shell already pads for the notch. NativeScript-Vue does not draw with HTML and CSS, so the kit does not run there.
99
+
100
+ ## How the components behave
101
+
102
+ - **Same look as the vanilla kit.** Each component draws the same HTML (same classes) as its vanilla piece, or runs the
103
+ vanilla piece inside an element Vue leaves alone, so the CSS, motion and accessibility are identical.
104
+ - **v-model.** A piece with a value takes `v-model` (or `default-value` to let it keep its own). A new value updates the
105
+ piece in place (it animates to it); it does not rebuild it. Changes inside arrays and objects you pass
106
+ (`rows.value.push(…)`) are noticed too. Overlays use `v-model:open`.
107
+ - **Events** are the vanilla callbacks with the same arguments: `@change`, `@select`, `@close`… (declared as `onX`
108
+ props, so a handler may also return a value, e.g. a promise).
109
+ - **Your content is Vue.** Titles, card bodies, modal and drawer bodies, popover and tooltip content, slides, steps,
110
+ kanban cards… are slots (`#title`, `#footer`, scoped slots like `#cell="{ row }"`). Nothing asks you for HTML
111
+ strings, except a few `render(value) → string` callbacks for many small cells (data grid), which say so in their types.
112
+ - **Template refs.** Pieces that the vanilla code builds (DataGrid, Calendar, Rating…) give their handle
113
+ (`rating.value.set(4)`, `rating.value.el`), the same methods as the vanilla API. Markup pieces give the component
114
+ (`.$el` is the element).
115
+ - **Booleans** work as attributes: `<Rating half read-only />`. A boolean you leave out keeps the piece's own default.
116
+ - **Server rendering.** Markup pieces render fully on the server. Pieces the vanilla code builds render an empty slot on
117
+ the server and appear when the page wakes up. Nothing reads `window` or `localStorage` during setup or render.
118
+ - **Reduced motion** is honoured everywhere, as in the vanilla kit.
119
+ - **Texts** shown by a piece come from a `words` prop (English by default), e.g. `:words="{ loading: 'กำลังโหลด…' }"`.
120
+ - **Any motion helper** without its own component runs on your own element with `useMotion`:
121
+ `const list = useMotion(rise)` then `<ul ref="list">…</ul>`.
122
+
123
+ ## Components
124
+
125
+ - [Basics](#basics): `Spinner`, `Button`, `IconButton`, `Tag`, `Badge`, `Avatar`, `AvatarGroup`, `Cell`, `CardHead`, `Card`, `Kpi`, `Empty`, `Table`, `Meter`, `Ring`, `Steps`, `Bars`, `Field`, `Input`, `Textarea`
126
+ - [Controls](#controls): `Switch`, `Segmented`, `normOption`, `Checkbox`, `Tabs`, `Chips`, `Range`, `Swatch`, `SearchBox`, `Select`, `Otp`
127
+ - [Forms](#forms): `MultiSelect`, `Combobox`, `TagsInput`, `RangeSlider`, `Stepper`, `Rating`, `RadioCards`, `SubscribeForm`, `PasswordMeter`, `PasswordToggle`, `AuthForm`, `SignaturePad`, `PhotoUpload`, `FileDrop`, `PricingToggle`, `DateRange`, `TimePicker`, `Wizard`, `useValidation`
128
+ - [Data display](#data-display): `Accordion`, `Carousel`, `BeforeAfter`, `Tree`, `DataGrid`, `VirtualList`, `Timeline`, `Calendar`, `SwipeItem`, `SwipeActions`, `Kanban`, `Notifications`, `Activity`, `Pagination`, `Breadcrumbs`, `Skeleton`, `Alert`
129
+ - [Action buttons](#action-buttons): `LikeButton`, `BellSwitch`, `PayButton`, `SpeedDial`, `Typing`
130
+ - [Charts](#charts): `LineChart`, `Donut`, `Gauge`, `Leaderboard`, `Heatmap`
131
+ - [Text & scroll motion](#text--scroll-motion): `TextReveal`, `Typewriter`, `Rotator`, `Shine`, `Highlighter`, `ScrollReveal`, `BlurIn`, `ScrollProgress`, `Odometer`, `CountUp`
132
+ - [Motion wrappers](#motion-wrappers): `Rise`, `Magnetic`, `Lift`, `Tilt`, `Spotlight`, `Marquee`, `useMotion`
133
+ - [Interactive effects](#interactive-effects): `Indicator`, `useIndicator`, `PageSwap`, `useFeedback`, `useFlash`, `useTick`, `ConfettiButton`, `useConfetti`, `confetti`, `Sortable`, `ThemeToggle`, `useTheme`, `SendButton`, `DeleteButton`, `DownloadButton`, `HoldButton`, `ExpandSearch`, `LiquidTabs`, `Burger`
134
+ - [Overlays](#overlays): `Modal`, `Drawer`, `confirm`, `useConfirm`, `Popover`, `Menu`, `ContextMenu`, `Tooltip`, `toast`, `CookieBanner`, `LoadingBar`, `useLoadingBar`, `CommandPalette`, `Tour`, `Lightbox`, `LightboxGallery`
135
+ - [App shell](#app-shell): `AppShell`, `useShell`, `shellBootScript`, `Sidebar`, `Topbar`, `PageHeader`, `MobileTabbar`
136
+
137
+ ## Basics
138
+
139
+ ### Spinner
140
+ The orbit loader: a small spinning comet on a faint ring.
141
+ ```vue
142
+ <Spinner :size="36" label="Loading bookings…" stack />
143
+ ```
144
+ - `size` (px or any CSS length), `tone` (`accent` `ink` `muted` `good` `warn` `bad` `current`), `speed` (seconds per lap)
145
+ - `label`, `stack` (label under the ring), `track` (default true), `decorative` (hidden from screen readers), `words`
146
+
147
+ ### Button
148
+ A button with a look (variant), a size and an optional icon; `busy` locks it and shows a spinner while it works.
149
+ ```vue
150
+ <Button variant="primary" icon="check" :busy="saving" busy-text="Saving…" @click="saveBooking">Save booking</Button>
151
+ ```
152
+ - `variant`: `primary` `dark` `ghost` `danger` · `size`: `sm` `lg`
153
+ - `icon`, `icon-right`: an icon name, a component or a VNode · `block`: full width · `magnetic`: leans toward the mouse
154
+ - `busy`, `busy-text`: working state (disabled, `aria-busy`, spinner) · every other attribute and listener goes on the `<button>`
155
+
156
+ ### IconButton
157
+ A square button that shows only an icon; the label is read by screen readers.
158
+ ```vue
159
+ <IconButton icon="bell" label="Notifications" @click="openInbox" />
160
+ <IconButton icon="heart" label="Favourite bike" v-model:pressed="fav" size="sm" />
161
+ ```
162
+ - `icon`, `label` (aria-label), `size: 'sm'` · default slot: anything after the icon
163
+ - `v-model:pressed` (or `default-pressed`): an on/off button (`aria-pressed`, pops when pressed) · `@change(pressed, event)`
164
+
165
+ ### Tag
166
+ A small coloured status label.
167
+ ```vue
168
+ <Tag :tone="booking.paid ? 'good' : 'warn'">{{ booking.paid ? 'Paid' : 'Unpaid' }}</Tag>
169
+ ```
170
+ - `tone`: `good` `warn` `bad` `accent` `plain` · `dot` (default true; `:dot="false"` hides it) · `icon` instead of the dot
171
+
172
+ ### Badge
173
+ A small round count.
174
+ ```vue
175
+ <Button variant="ghost">Inbox <Badge tone="accent">{{ unread }}</Badge></Button>
176
+ ```
177
+ - `tone: 'accent'` · default slot: the number
178
+
179
+ ### Avatar
180
+ A round avatar with initials in one of eight colours; without a name it is an empty "open slot".
181
+ ```vue
182
+ <Avatar name="Pim Wong" tone="teal" size="lg" online />
183
+ <Avatar /> <!-- nobody assigned yet -->
184
+ ```
185
+ - `name` (tooltip, initials), `ini`, `tone` (`indigo` `teal` `rose` `amber` `violet` `green` `slate` `sky`)
186
+ - `size`: `sm` `lg` · `online`: green dot
187
+
188
+ ### AvatarGroup
189
+ Small overlapping avatars, then "+N".
190
+ ```vue
191
+ <AvatarGroup :people="task.assignees" :max="4" />
192
+ ```
193
+ - `people`: `{ id?, name, ini?, tone? }[]` · `max` (default 4)
194
+
195
+ ### Cell
196
+ An avatar with a name and a small line under it, for lists and table cells.
197
+ ```vue
198
+ <Cell :name="rider.name" tone="rose" :sub="rider.phone" />
199
+ <Cell :name="rider.name"><template #sub><a :href="`tel:${rider.phone}`">{{ rider.phone }}</a></template></Cell>
200
+ ```
201
+ - `name`, `ini`, `tone`, `online` · `sub`: text, or the `#sub` slot
202
+
203
+ ### CardHead
204
+ Just the head row of a card: a title, a small line and things on the right.
205
+ ```vue
206
+ <CardHead title="Today" :sub="`${bookings.length} bookings`">
207
+ <template #right><Button size="sm" variant="ghost">See all</Button></template>
208
+ </CardHead>
209
+ ```
210
+ - `title`, `sub`, `right`: text props, or `#title` / `#sub` / `#right` slots
211
+
212
+ ### Card
213
+ A white panel with an optional head (title, small line, things on the right); `lift` rises on hover.
214
+ ```vue
215
+ <Card title="Today" :sub="`${bookings.length} bookings`" lift>
216
+ <template #right><Button size="sm" variant="ghost" @click="openAll">See all</Button></template>
217
+ <BookingList :items="bookings" />
218
+ </Card>
219
+ ```
220
+ - `title`, `sub`, `right`: text props or `#title` / `#sub` / `#right` slots (the head shows when there is a title)
221
+ - `flush`: no padding (tables, lists) · `lift` · default slot: the body
222
+
223
+ ### Kpi
224
+ A number tile: a caption, a big value and a small line.
225
+ ```vue
226
+ <div class="gk-kpis">
227
+ <Kpi label="Bikes out" :value="12" sub="of 20" />
228
+ <Kpi label="Revenue" value="฿48,250" sub="This month" tone="good" />
229
+ </div>
230
+ ```
231
+ - `label`, `value`, `sub`: text props or `#label` / `#value` / `#sub` slots · `tone`: `accent` `good` `bad`
232
+
233
+ ### Empty
234
+ What to show when a list has nothing in it.
235
+ ```vue
236
+ <Empty icon="search" :title="`No bikes match “${q}”`" body="Check the spelling or try a shorter word.">
237
+ <template #action><Button size="sm" icon="close" @click="q = ''">Clear search</Button></template>
238
+ </Empty>
239
+ ```
240
+ - `icon` (default `inbox`), `title`, `body`: props or `#title` / `#body` slots · `#action`: a button under the text
241
+
242
+ ### Table
243
+ A table styled by `.gk-table`, inside `.gk-table-wrap` so it scrolls sideways on phones. Give it columns and rows (and draw cells with slots), or write the `<thead>`/`<tbody>` yourself.
244
+ ```vue
245
+ <script setup>
246
+ const columns = [{ key: 'rider', title: 'Rider' }, { key: 'status', title: 'Status' }, { key: 'days', title: 'Days', align: 'right' }];
247
+ </script>
248
+ <template>
249
+ <Card title="Bookings" flush>
250
+ <Table :rows="bookings" :columns="columns" row-key="id" slide-rows>
251
+ <template #cell-rider="{ row }"><Cell :name="row.rider" :sub="row.phone" /></template>
252
+ <template #cell-status="{ row }"><Tag :tone="row.paid ? 'good' : 'warn'">{{ row.paid ? 'Paid' : 'Unpaid' }}</Tag></template>
253
+ <template #foot><tr><td>Total</td><td></td><td class="gk-r">{{ totalDays }}</td></tr></template>
254
+ </Table>
255
+ </Card>
256
+ </template>
257
+ ```
258
+ - `columns`: `{ key, title, align: 'right', class, render(row, i) }[]` · `rows` · `row-key` (field or function)
259
+ - slots: `#cell-<key>="{ row, column, value, index }"` for one column, `#cell="{ … }"` for any column (when it renders nothing the plain value shows), `#head-<key>` / `#head="{ column }"`, `#foot` (`<tr>`s for a `<tfoot>`)
260
+ - without `columns`: the default slot is the table's content · `slide-rows`: rows slide in when they first appear · `:wrap="false"` · attributes go on the `<table>`
261
+
262
+ ### Meter
263
+ A thin bar that fills from zero, and glides when the value changes.
264
+ ```vue
265
+ <Meter :value="task.done / task.total" :tone="late ? 'warn' : undefined" />
266
+ ```
267
+ - `value`: 0 to 1 · `tone`: `good` `warn` `bad` · `delay`
268
+
269
+ ### Ring
270
+ A round progress ring with a label in the middle; it sweeps on from the last value.
271
+ ```vue
272
+ <Ring :value="0.72" :size="80" :stroke="8" label="72%" />
273
+ ```
274
+ - `value`: 0 to 1 · `size` (56), `stroke` (6) · `label` or the `#label` slot
275
+
276
+ ### Steps
277
+ A row of numbered steps: done ones get a tick, the bar fills up to the current one, the new dot pops.
278
+ ```vue
279
+ <Steps :labels="['Bike', 'Dates', 'Extras', 'Pay']" :now="step" />
280
+ ```
281
+ - `labels` · `now`: the current step from 0 · `#label="{ label, index }"` to draw a label yourself
282
+
283
+ ### Bars
284
+ A small column chart: bars grow up from the baseline, then morph when the values change.
285
+ ```vue
286
+ <Bars :values="perDay" :labels="['Mon', 'Tue', 'Wed', 'Thu', 'Fri']" show-values :height="160" :format="(v) => v + ' h'" />
287
+ ```
288
+ - `values`, `max` (default: the biggest), `labels`, `show-values`, `format(value, index)`
289
+ - `highlight-top` (default true), `height` (210 px, or any CSS length), `label` for screen readers
290
+
291
+ ### Field
292
+ A label above a control and a small hint under it.
293
+ ```vue
294
+ <Field label="Phone" hint="We text the pick-up code here." :invalid="!!error">
295
+ <Input v-model="phone" type="tel" />
296
+ </Field>
297
+ ```
298
+ - `label`, `hint`: text props or `#label` / `#hint` slots · `invalid`: red border and hint · default slot: the control
299
+
300
+ ### Input
301
+ A text box with the kit's look: an `<input class="gk-input">`.
302
+ ```vue
303
+ <Input v-model.trim="email" type="email" placeholder="you@shop.com" size="sm" @blur="checkEmail" />
304
+ ```
305
+ - `v-model` works like on a native input (`.lazy`, `.trim`, `.number`, waits for Thai/IME typing to finish) · or `default-value`
306
+ - `size: 'sm'` · `type` (default `text`) · every other attribute and listener (`placeholder`, `name`, `@input`, `@change`…) goes on the `<input>`
307
+
308
+ ### Textarea
309
+ A text area with the same look; `auto-grow` makes it taller with each line, up to a limit.
310
+ ```vue
311
+ <Field label="Note for the mechanic"><Textarea v-model="note" :rows="1" :auto-grow="6" /></Field>
312
+ ```
313
+ - `v-model` like a native `<textarea>` · `auto-grow`: `true` (6 lines) or a number of lines · `size: 'sm'` · all `<textarea>` attributes
314
+
315
+ ## Controls
316
+
317
+ ### Switch
318
+ An on/off switch; the knob springs across.
319
+ ```vue
320
+ <Switch v-model="settings.sms" label="SMS reminders" @change="(on) => save({ sms: on })" />
321
+ ```
322
+ - `v-model` (boolean) or `default-value` · `@change(checked, event)` · `label` (aria-label)
323
+
324
+ ### Segmented
325
+ A row of options where exactly one is picked; the thumb stretches to the new choice.
326
+ ```vue
327
+ <Segmented v-model="view" :options="[['list', 'List', 'list'], ['board', 'Board', 'cards']]" />
328
+ ```
329
+ - `options`: `[value, label, icon?, count?]`, `{ value, label, icon, count, disabled }` or strings · `v-model` / `default-value` · `@change(value, event)` · `size: 'sm'`
330
+ - `count` — a number after the label, e.g. `['free', 'Free', null, 4]` shows **Free 4**
331
+
332
+ ### normOption
333
+ Turns any option form (`['id', 'Label', 'icon']`, `{ value, label }`, `'id'`) into `{ value, label, icon, disabled }`, for your own option lists.
334
+ ```js
335
+ const list = bikes.map(normOption);
336
+ ```
337
+
338
+ ### Checkbox
339
+ A tick box that pops when ticked.
340
+ ```vue
341
+ <Checkbox v-model="task.done" :label="task.title" @change="(done) => updateTask(task.id, { done })" />
342
+ ```
343
+ - `v-model` (boolean) or `default-value` · `@change(checked, event)` · `label` (aria-label)
344
+
345
+ ### Tabs
346
+ Tab buttons with a line that stretches to the selected one; a count shows as a badge.
347
+ ```vue
348
+ <Tabs v-model="tab" :items="[['all', 'All tasks'], ['mine', 'Mine', myCount], ['done', 'Done']]" />
349
+ ```
350
+ - `items`: `[value, label, count?]`, `{ value, label, count, disabled }` or strings · `v-model` / `default-value` · `@change(value, event)` · `name`
351
+
352
+ ### Chips
353
+ Pill buttons for filters: one picked, or several with `multi`.
354
+ ```vue
355
+ <Chips v-model="kind" :options="[['all', 'All'], ['scooter', 'Scooters', 'moto'], ['ebike', 'E-bikes', 'bike']]" />
356
+ <Chips v-model="shifts" multi :options="['morning', 'day', 'late']" />
357
+ ```
358
+ - `options` (like Segmented) · `multi` · `v-model` / `default-value` (an array with `multi`) · `@change(value | values, event)` · `name`
359
+
360
+ ### Range
361
+ A slider with a filled track (it fills up from zero when first shown) and a springy thumb.
362
+ ```vue
363
+ <Field label="Days" :hint="`${days} days`"><Range v-model="days" :min="1" :max="14" /></Field>
364
+ ```
365
+ - `min`, `max`, `step` · `v-model` (a number) or `default-value` (default: halfway) · `@change(value, event)` while it moves
366
+
367
+ ### Swatch
368
+ A colour picker drawn as a round swatch; it pops when a colour is picked.
369
+ ```vue
370
+ <Swatch v-model="label.colour" aria-label="Label colour" />
371
+ ```
372
+ - `v-model` / `default-value` (`'#rrggbb'`, default `#5b4cf0`) · `@change(value, event)` while the colour changes
373
+
374
+ ### SearchBox
375
+ A text field with a magnifying glass; Enter searches, an empty box shakes.
376
+ ```vue
377
+ <SearchBox v-model="q" placeholder="Search bikes…" @search="(text) => router.push({ path: '/bikes', query: { q: text } })" />
378
+ ```
379
+ - `placeholder` (also the aria-label) · `v-model` / `default-value` · `@change(value, event)` as it is typed · `@search(text, event)` · `size: 'sm'`
380
+ - `class` / `style` go on the box; every other attribute and listener (`name`, `@keydown`…) goes on the `<input>`
381
+
382
+ ### Select
383
+ The animated dropdown: a real `<select>` (forms and `FormData` keep working) shown as a button whose list pops out, with a highlight that follows the mouse and the arrow keys.
384
+ ```vue
385
+ <Field label="Assign to">
386
+ <Select v-model="owner" name="owner" :options="[
387
+ { group: 'Design', options: [['pim', 'Pim Wong'], ['ann', 'Ann Ko']] },
388
+ { group: 'Engineering', options: [['tom', 'Tom Lee'], ['max', 'Max Ru']] },
389
+ ]" />
390
+ </Field>
391
+ ```
392
+ - `options`: `[value, label, icon?]`, `{ value, label, icon, disabled }`, strings, or `{ group, options }` (labels are text, icons are icon names)
393
+ - `v-model` / `default-value` (default: the first option) · `@change(value, event)` · `size: 'sm'` · `disabled`, `name`, `aria-label`… go on the `<select>`
394
+ - the template ref's `$el.querySelector('select')` is the `<select>`; `dropdown(select)` from `@gecko-ui-kit/overlays` gives `{ open, close, sync }`
395
+
396
+ ### Otp
397
+ A code field with one box per character: typing moves on, Backspace goes back, paste or the phone's code autofill fills every box. Return the answer from `@complete` to play it.
398
+ ```vue
399
+ <Otp v-model="code" :length="6" split autofocus @complete="async (c) => (await api.verifyPhone(c)).ok" />
400
+ ```
401
+ - `length` (6), `split`, `mask` (PIN dots), `letters` (A–Z too), `label`, `name`
402
+ - `@complete(code, el)`: return / resolve `true` (green wave, then a tick) or `false` (shake, then clear) · `gather`, `clear`
403
+ - `v-model` / `default-value`, `@change(code)` as it is typed · `disabled` · `autofocus` · the template ref's `$el` is the `.gk-otp` element (`otpState` / `otpClear` work on it)
404
+
405
+ ## Forms
406
+
407
+ ### MultiSelect
408
+ Pick several people, labels or options; each pick flies up into the field as a chip.
409
+ ```vue
410
+ <script setup>
411
+ const who = ref(['ploy'])
412
+ const team = [{ value: 'ploy', label: 'Ploy', person: true }, { value: 'tom', label: 'Tom', person: true }]
413
+ </script>
414
+ <template>
415
+ <MultiSelect v-model="who" :options="team" :max="3" placeholder="Assign to…" />
416
+ </template>
417
+ ```
418
+ - `v-model` (or `default-value`): the picked values; a new value or new `options` are applied in place
419
+ - `options` (strings or `{ value, label, sub, group, person, color, icon, disabled }`), `max`, `creatable`, `close-on-select`, `name`, `disabled`, `words`
420
+ - `@change(values, options, ms)`, `@create(option, ms)`; ref: `set`, `add`, `remove`, `clear`, `open`, `setOptions`
421
+
422
+ ### Combobox
423
+ A text field you type into to find one option; it can ask your server instead of a fixed list.
424
+ ```vue
425
+ <Combobox v-model="branch" label="Pick-up branch" :options="branches" />
426
+ <Combobox v-model="customer" label="Customer" :source="(q, { signal }) => $fetch('/api/customers', { query: { q }, signal })" />
427
+ ```
428
+ - `v-model` (or `default-value`): the picked value (or `{ value, label }` with a source); gets the value or `null`
429
+ - `options` or `source(query, { signal })`, `clearable`, `allow-custom`, `min-chars`, `debounce`, `max-results`, `name`, `label`, `disabled`, `words`
430
+ - `@change(value, option, cb)`, `@input(text, cb)`
431
+
432
+ ### TagsInput
433
+ Type words and each one becomes a tag; a comma or Enter makes a tag, pasting a list makes many.
434
+ ```vue
435
+ <TagsInput v-model="labels" :suggestions="['bug', 'design', 'mobile']" :max="5" />
436
+ ```
437
+ - `v-model` (or `default-value`): the tags, applied in place
438
+ - `suggestions`, `max`, `unique`, `separators`, `validate(text) → true | 'message'`, `transform(text)`, `name`, `disabled`, `words`
439
+ - `@change(tags, ti)`; ref: `add`, `remove`, `clear`, `set`
440
+
441
+ ### RangeSlider
442
+ Two thumbs for a low and a high value, with an optional histogram behind the track.
443
+ ```vue
444
+ <RangeSlider v-model="price" label="Price per day" :min="0" :max="2000" :step="50"
445
+ :format="(v) => `฿${v.toLocaleString()}`" :histogram="[2, 5, 9, 4, 1]" />
446
+ ```
447
+ - `v-model` (or `default-value`): `[low, high]`; the thumbs glide to a new value
448
+ - `min`, `max`, `step`, `min-gap`, `format`, `parse`, `marks`, `histogram`, `inputs`, `name`, `label`, `disabled`, `words`
449
+ - `@input(value, rs)` while dragging, `@change(value, rs)` when it settles (v-model follows `@change`)
450
+
451
+ ### Stepper
452
+ − and + around a number whose digits roll like an odometer.
453
+ ```vue
454
+ <Stepper v-model="days" :min="1" :max="30" :unit="(n) => (n === 1 ? 'day' : 'days')" />
455
+ ```
456
+ - `v-model` (or `default-value`), `min`, `max` (applied in place; a value outside is pulled in), `step`
457
+ - `unit`, `prefix`, `format`, `locale`, `size`, `name`, `disabled`, `words`
458
+ - `@change(value, st)`; ref: `set`, `stepBy`, `setRange`
459
+
460
+ ### Rating
461
+ Stars (or hearts) to give a score, or to show one read-only.
462
+ ```vue
463
+ <Rating v-model="score" :labels="['Bad', 'Poor', 'Okay', 'Good', 'Great']" />
464
+ <Rating :default-value="4.6" read-only size="sm" />
465
+ ```
466
+ - `v-model` (or `default-value`), `max`, `half`, `read-only` (applied in place), `clearable`
467
+ - `icon`, `size`, `labels`, `show-value`, `name`, `disabled`, `words`
468
+ - `@change(value, r)`; ref: `set`, `setReadOnly`
469
+
470
+ ### RadioCards
471
+ Choices drawn as cards (real radio buttons underneath), exactly one picked.
472
+ ```vue
473
+ <RadioCards v-model="bike" label="Choose a bike" :options="[
474
+ { value: 'scoot', title: 'Scooter 125', desc: 'Easy in town', price: '฿350 / day', icon: 'moto' },
475
+ { value: 'big', title: 'Scooter 160', desc: 'For two', price: '฿550 / day', badge: 'Popular' },
476
+ ]" />
477
+ ```
478
+ - `v-model` (or `default-value`), `options` (`{ value, title, desc, price, icon, badge, disabled }`)
479
+ - `label`, `hide-label`, `layout` (`list` | `grid`), `min`, `name`, `required`, `disabled`, `words`
480
+ - `@change(value, option, plan)`
481
+
482
+ ### SubscribeForm
483
+ One email field and a button; the button grows into the thank-you message.
484
+ ```vue
485
+ <script setup>
486
+ async function join(email) {
487
+ await $fetch('/api/waitlist', { method: 'POST', body: { email } }) // throw to show the error
488
+ }
489
+ </script>
490
+ <template>
491
+ <SubscribeForm icon="mail" :words="{ button: 'Join the waitlist' }" @submit="join" />
492
+ </template>
493
+ ```
494
+ - `default-value`, `name`, `icon`, `layout` (`row` | `stack`), `validate(email)`, `reset-after`, `words`
495
+ - `@submit(email, sub)`: resolve (a string replaces the thanks text) or reject to show the error; ref: `setError`, `reset`, `state`
496
+
497
+ ### PasswordMeter
498
+ A password field with the strength meter after it: bars, a checklist that ticks off and a padlock.
499
+ ```vue
500
+ <div class="gk-field">
501
+ <label for="team-pw">Password for the team account</label>
502
+ <PasswordMeter id="team-pw" v-model="pw" reveal :min="10" @change="(s) => (canSave = s.valid)" />
503
+ </div>
504
+ ```
505
+ - The meter: `rules` (`{ id, test, label }`), `min`, `min-score`, `score`, `reveal`, `list`, `lock`, `words`, `@change({ score, level, valid, rules }, pw)`
506
+ - The text: `v-model` (or `default-value`) and `@value-change(text, event)`; every other attribute (`id`, `name`, `placeholder`…) goes on the `<input>`
507
+ - ref: `score`, `level`, `valid`, `rules`, `check()`, `reveal(on)`
508
+
509
+ ### PasswordToggle
510
+ A password field with a show / hide eye inside it (drawn by Vue, so it renders fully on the server).
511
+ ```vue
512
+ <PasswordToggle v-model="password" name="password" autocomplete="current-password" @toggle="(shown) => track(shown)" />
513
+ ```
514
+ - `v-model` (or `default-value`): the text; `v-model:shown` (or `default-shown`) and `@toggle(shown)`: the eye; `words: { show, hide }`
515
+ - Every other attribute goes on the `<input>`; ref: `input`, `focus()`
516
+
517
+ ### AuthForm
518
+ One card for signing in and creating an account, with checks, a strength meter and a busy button.
519
+ ```vue
520
+ <script setup>
521
+ const mode = ref('in')
522
+ async function submit(values, mode) {
523
+ const r = await fetch(`/api/${mode === 'up' ? 'sign-up' : 'sign-in'}`, { method: 'POST', body: JSON.stringify(values) })
524
+ if (r.status === 401) throw Object.assign(new Error('That password isn’t right.'), { field: 'password' })
525
+ }
526
+ </script>
527
+ <template>
528
+ <AuthForm v-model:mode="mode" :fields="{ confirm: true }" @forgot="(email) => sendResetLink(email)" @submit="submit" />
529
+ </template>
530
+ ```
531
+ - `v-model:mode` (or `default-mode`): `in` | `up`, applied in place; `fields`, `meter`, `min`, `values` (filled in when it mounts), `validate`, `words`
532
+ - `@submit(values, mode, f)`, `@mode-change(mode, f)`, `@forgot(email, f)`; ref: `setMode`, `setError`, `reset`, `values`
533
+
534
+ ### SignaturePad
535
+ Sign with a finger, pen or mouse; the ink is thinner when you move fast.
536
+ ```vue
537
+ <script setup>
538
+ const sig = ref(null)
539
+ const send = () => saveAgreement(sig.value.toJSON(), sig.value.toImage({ background: '#fff' }))
540
+ </script>
541
+ <template>
542
+ <SignaturePad ref="sig" :words="{ hint: 'Sign here' }" @change="(empty) => (signed = !empty)" />
543
+ <Button variant="primary" @click="send">Sign and send</Button>
544
+ <SignaturePad read-only :tools="false" :default-value="agreement.strokes" />
545
+ </template>
546
+ ```
547
+ - `color`, `width`, `pressure`, `guide`, `tools`, `read-only`, `default-value` (saved `toJSON()` data), `words`
548
+ - `@change(isEmpty, sig)`, `@end(sig)`; ref: `undo`, `clear`, `replay`, `toJSON`, `fromJSON`, `toImage`, `toSVG`
549
+ - Changing `read-only` or another option keeps what was signed
550
+
551
+ ### PhotoUpload
552
+ Drop, pick or paste photos; each tile uploads with a ring and can be dragged to reorder (the first is the cover).
553
+ ```vue
554
+ <PhotoUpload v-model="bike.photos" :max="8"
555
+ :upload="(file, { progress, signal }) => uploadPhoto(file, { onProgress: progress, signal })" />
556
+ ```
557
+ - `v-model` (or `default-value`): photos already uploaded (`[{ url }]` or URLs); after every change it gets each photo's upload result, in order
558
+ - `accept`, `max`, `max-size` (MB), `upload`, `concurrent`, `resize`, `cover`, `sortable`, `read-only`, `capture`, `words`
559
+ - `@change(items, up)`, `@reject`, `@uploaded`, `@error`; ref: `value`, `settled()`, `add`, `remove`, `move`, `open`
560
+
561
+ ### FileDrop
562
+ A drop zone that lists each file with its own progress bar, tick or error.
563
+ ```vue
564
+ <FileDrop accept=".pdf,image/*" :max-size="10 * 1024 * 1024"
565
+ :upload="(file, { progress, signal }) => sendReceipt(file, progress, signal)" @change="(files) => (receipts = files)" />
566
+ ```
567
+ - `accept`, `multiple`, `max-size` (bytes), `max-files`, `upload`, `auto`, `concurrent`, `compact`, `words`
568
+ - `@change(files, fd)`, `@error(problem, fd)`; ref: `files`, `value`, `add`, `retry`, `cancel`, `clear`, `browse`, `upload()`
569
+
570
+ ### PricingToggle
571
+ Plan cards with a monthly / yearly switch; every price rolls to its new number.
572
+ ```vue
573
+ <PricingToggle v-model="period" locale="th-TH" :format="{ style: 'currency', currency: 'THB', maximumFractionDigits: 0 }"
574
+ :plans="[{ id: 'shop', name: 'Shop', price: { month: 390, year: 290 }, features: ['20 bikes'], action: 'Choose Shop', featured: true }]"
575
+ @select="(plan, period) => navigateTo(`/checkout?plan=${plan.id}&period=${period}`)" />
576
+ ```
577
+ - `v-model` (or `default-value`): the period id; `plans`, `periods`, `format`, `locale`, `motion` (`roll` | `count`), `strike`, `words`
578
+ - `@change(periodId, prices)`, `@select(plan, periodId, prices)`
579
+ - Plan texts are plain strings (the piece draws them)
580
+
581
+ ### DateRange
582
+ A month calendar to pick a start and an end (or one date), counting the days or nights.
583
+ ```vue
584
+ <script setup>
585
+ const dates = ref({ start: '2026-12-04', end: '2026-12-07' })
586
+ </script>
587
+ <template>
588
+ <DateRange v-model="dates" count="days" :min="today" :disabled="bookedDays" :months="2" />
589
+ </template>
590
+ ```
591
+ - `v-model` (or `default-value`): `{ start, end }` or one date (`'YYYY-MM-DD'` or `Date`); it gets `{ start, end, count }` back (end is `null` until it is picked)
592
+ - `mode` (`range` | `single`), `months`, `min`, `max`, `disabled`, `count`, `min-days`, `max-days`, `block-span`, `presets`, `locale`, `week-start`, `words`
593
+ - `@change(value, dp)`, `@invalid(reason, dp)`
594
+
595
+ ### TimePicker
596
+ A wheel or a grid of time slots.
597
+ ```vue
598
+ <TimePicker v-model="pickUp" look="slots" min="09:00" max="18:00" :disabled="takenSlots" />
599
+ ```
600
+ - `v-model` (or `default-value`): `'HH:MM'`; `look` (`wheel` | `slots`), `step`, `min`, `max`, `disabled` (applied in place), `hour12`, `words`
601
+ - `@change(value, tp)`; ref: `set`, `setDisabled`, `format`
602
+
603
+ ### Wizard
604
+ A long form split into steps that slide sideways; each step's content is your own Vue, in a slot named after the step's id.
605
+ ```vue
606
+ <script setup>
607
+ const steps = [
608
+ { id: 'bike', title: 'Bike' },
609
+ { id: 'rider', title: 'Rider' },
610
+ { id: 'pay', title: 'Payment', validate: () => (paid.value ? true : 'Choose how to pay.') },
611
+ ]
612
+ </script>
613
+ <template>
614
+ <Wizard :steps="steps" :words="{ finish: 'Book' }" @finish="(values) => book(values)">
615
+ <template #bike><BikePicker /></template>
616
+ <template #rider><label class="gk-field"><span>Phone</span><input class="gk-input" name="phone" required /></label></template>
617
+ <template #pay><PaymentStep /></template>
618
+ </Wizard>
619
+ </template>
620
+ ```
621
+ - `steps` (`{ id, title, sub, optional, validate(panel, wz), content }`); slots: `#<id>` per step, or `#step="{ step, index }"` for every step (`content` is plain text when there is no slot)
622
+ - `v-model:index` (applied with `go()`, without checking) or `start`; `linear`, `header` (`steps` | `bar` | `none`), `level`, `label`, `words`
623
+ - `@step(index, wz)`, `@finish(values, wz)`; ref: `next()`, `back()`, `go(i)`, `reset()`, `values`
624
+ - Without `validate`, the browser's own checks run on the step's fields (`required`, `type="email"`…)
625
+
626
+ ### useValidation
627
+ The red-field pattern from the Validation page (`.gk-field.gk-is-bad`, the reason in `.gk-field__hint`, a small shake) as a composable.
628
+ It is a pattern, not a piece: you draw the fields, the composable keeps the messages.
629
+ ```vue
630
+ <script setup>
631
+ import { useValidation } from '@gecko-ui-kit/vue'
632
+ const v = useValidation({
633
+ name: (x) => (x.trim() ? '' : 'Please type your name.'),
634
+ email: (x) => (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(x) ? '' : 'That email looks incomplete.'),
635
+ })
636
+ </script>
637
+ <template>
638
+ <label :class="['field', { 'is-bad': v.errors.email }]">
639
+ <span>Email</span>
640
+ <input class="gk-input" type="email" v-bind="v.field('email')" />
641
+ <small class="gk-field__hint">{{ v.errors.email || 'We send one email when we launch.' }}</small>
642
+ </label>
643
+ <Button variant="primary" @click="v.validate() && join(v.values())">Join the waitlist</Button>
644
+ </template>
645
+ ```
646
+ - A rule gets `(value, values)` and returns `''` (fine) or the message; call it in `setup()`
647
+ - `v-bind="v.field(name)"` puts `name`, a ref, `@input` and `aria-invalid` on the input; `v.validate()` marks and shakes the bad fields, true when all are fine
648
+ - `v.errors` (reactive), `v.check(name)`, `v.setError(name, message)` (e.g. a server answer), `v.reset()`, `v.values()`
649
+ - Options: `{ live: true }` re-checks a red field on every key, `{ shake: true }`
650
+
651
+ ## Data display
652
+
653
+ ### Accordion
654
+ A list of headings that open to show more. The panel grows open and the chevron turns.
655
+
656
+ ```vue
657
+ <script setup>
658
+ const open = ref(['deposit'])
659
+ const faq = [
660
+ { id: 'helmet', title: 'Is a helmet included?', content: 'Yes, two helmets come with every bike.' },
661
+ { id: 'deposit', title: 'Deposit', sub: 'Returned at drop-off' },
662
+ ]
663
+ </script>
664
+
665
+ <template>
666
+ <Accordion v-model="open" :items="faq">
667
+ <template #content="{ item }">
668
+ <DepositInfo v-if="item.id === 'deposit'" :bike="bike" />
669
+ <p v-else>{{ item.content }}</p>
670
+ </template>
671
+ </Accordion>
672
+ </template>
673
+ ```
674
+ - `items`: `{ id, title, sub, icon, badge, content, open, disabled }`. `content` and `title` are text.
675
+ - Slots: `#content="{ item, index }"` draws each panel, `#title="{ item, index }"` draws every heading.
676
+ - `v-model` (or `default-value`): the open ids. `@change(openIds)` · `@toggle(id, open)`.
677
+ - `multiple`, `collapsible`, `look: 'lines' | 'cards'`, `marker: 'chevron' | 'plus'`, `level`. Template ref: `open`, `close`, `closeAll`, `filter`…
678
+
679
+ ### Carousel
680
+ Slides you swipe, drag or step through. The current dot stretches into a pill.
681
+
682
+ ```vue
683
+ <Carousel v-model="slide" :per-view="{ 0: 1, 640: 2, 960: 3 }" :peek="40" label="Bikes">
684
+ <BikeCard v-for="b in bikes" :key="b.id" :bike="b" />
685
+ </Carousel>
686
+ ```
687
+ - Each child of the default slot is one slide (a `v-for` works). `v-model` (or `default-value`): the slide index. `@change(index)`.
688
+ - `per-view`, `gap`, `peek`, `focus`, `rewind`, `autoplay` (ms), `arrows`, `dots`, `label`, `words`. Template ref: `go(i)`, `next()`, `prev()`, `play()`, `pause()`.
689
+
690
+ ### BeforeAfter
691
+ Two pictures on top of each other, with a divider you drag to wipe between them.
692
+
693
+ ```vue
694
+ <BeforeAfter hint>
695
+ <template #before><img src="/repairs/42-before.jpg" alt="Scratched side panel" /></template>
696
+ <template #after><img src="/repairs/42-after.jpg" alt="Repaired side panel" /></template>
697
+ </BeforeAfter>
698
+ ```
699
+ - Slots `#before` and `#after` (or the `before` / `after` text props).
700
+ - `v-model` (or `default-value`): 0–100 (default 50). `@change(value)` while it moves.
701
+ - `hover`, `hint`, `labels`, `ratio` ('4/3'), `step`, `words`.
702
+
703
+ ### Tree
704
+ Nested items that open and close, like folders, with keyboard support and optional checkboxes.
705
+
706
+ ```vue
707
+ <Tree
708
+ v-model="picked"
709
+ v-model:checked="ticked"
710
+ :items="[{ id: 'scooters', label: 'Scooters', children: [{ id: 'click', label: 'Honda Click' }, { id: 'nmax', label: 'Yamaha NMAX' }] }]"
711
+ checkable
712
+ label="Fleet"
713
+ @activate="(item) => openBike(item.id)"
714
+ />
715
+ ```
716
+ - `items`: `{ id, label, icon, badge, children, open, disabled }`; `children: true` loads them with `load(item)` when it first opens.
717
+ - `v-model` (or `default-value`): the selected ids. `v-model:checked`: the ticked ids. Both change in place.
718
+ - `select: 'single' | 'multiple' | 'none'`, `checkable`, `lines`, `icons`, `open-on-click`. `@select(ids, item)` · `@check(ids)` · `@toggle(id, open)` · `@activate(item)`.
719
+
720
+ ### DataGrid
721
+ A table people can search, filter, sort, page through and edit in place. Rows glide when the order changes.
722
+
723
+ ```vue
724
+ <DataGrid
725
+ :columns="[
726
+ { key: 'plate', label: 'Plate' },
727
+ { key: 'model', label: 'Model', type: 'select', options: ['Click', 'NMAX'], filter: true },
728
+ { key: 'rate', label: 'Rate / day', type: 'number', align: 'right', edit: true },
729
+ ]"
730
+ :rows="bikes"
731
+ @change="(row, key, value) => saveBike(row.id, { [key]: value })"
732
+ />
733
+ ```
734
+ - A new `rows` is applied in place with `setRows()`. Nothing happens when it already matches what is on screen.
735
+ - `search`, `page-size`, `select`, `add`, `remove`, `density`, `stripes`, `row-key` (the id field, default `'id'`). `@change(row, key, value, old)` · `@add(row)` · `@remove(rows)`.
736
+ - `columns[].render(value, row)` returns trusted HTML. Escape app text yourself, or use `format` for plain text.
737
+
738
+ ### VirtualList
739
+ Thousands of rows, but only the ones you can see are in the page.
740
+
741
+ ```vue
742
+ <VirtualList v-model="pickedId" :items="customers" :row-height="56" :height="480" selectable label="Customers">
743
+ <template #item="{ item }"><CustomerRow :customer="item" /></template>
744
+ </VirtualList>
745
+ ```
746
+ - Slot `#item="{ item, index }"` draws each row on screen (or `render(item, index)` → trusted HTML).
747
+ - `items`: an array or a count. A new `items` is applied in place. `row-height`: px or `'auto'` (measured).
748
+ - `v-model` (or `default-value`): the key of the picked row (`selectable`). `item-key(item, index)`. `@select(item, index)` · `@range(range)`. Template ref: `scrollTo(i)`, `select(i)`, `refresh()`.
749
+
750
+ ### Timeline
751
+ Bookings as bars on a row per bike, room or person. Drag a bar to move it, pull its end to make it longer.
752
+
753
+ ```vue
754
+ <Timeline
755
+ title="Fleet"
756
+ :rows="bikes.map((b) => ({ id: b.id, label: b.name }))"
757
+ :items="bookings"
758
+ from="2026-12-01"
759
+ :days="14"
760
+ @change="(booking) => saveBooking(booking)"
761
+ @add="({ row, start }) => newBooking(row, start)"
762
+ />
763
+ ```
764
+ - `items`: `{ id, row, start, end, label, status, color, edit }`. Changes are applied in place (bars glide and grow).
765
+ - `from`, `days`, `locale`, `edit`, `overlap`, `now`, `late`, `sub(item, days)`. `@change(item, before)` · `@open(item, bar)` · `@add({ row, start })` · `@clash(item, other)`.
766
+
767
+ ### Calendar
768
+ A month of days with your events on them. Drag an event to another day.
769
+
770
+ ```vue
771
+ <Calendar v-model="day" v-model:month="month" :events="bookings" draggable locale="th"
772
+ @move="(ev, start, end) => moveBooking(ev.id, start, end)" />
773
+ ```
774
+ - `events`: `{ id, title, start, end, tone, allDay, time }`. A new `events` is applied in place.
775
+ - `v-model` (or `default-value`): the picked day (a click gives a `Date`). `v-model:month`: the month on show.
776
+ - `week-start`, `max-per-day`, `selectable`, `draggable`, `size: 'sm'`. `@day(date, events)` · `@event(event)` · `@month(date)` · `@move(event, start, end)` (return false to put it back).
777
+
778
+ ### SwipeItem and SwipeActions
779
+ Rows you swipe left or right to show actions behind them, like a phone's mail app.
780
+
781
+ ```vue
782
+ <SwipeActions class="gk-card gk-card--flush" @action="(action, ctx) => action === 'cancel' && cancelBooking(ctx.id)">
783
+ <SwipeItem v-for="b in bookings" :key="b.id" :id="b.id"
784
+ :start="[{ id: 'call', label: 'Call', icon: 'phone', tone: 'accent' }]"
785
+ :end="[{ id: 'cancel', label: 'Cancel', icon: 'trash', tone: 'bad', remove: true }]">
786
+ <BookingRow :booking="b" />
787
+ </SwipeItem>
788
+ </SwipeActions>
789
+ ```
790
+ - `SwipeItem`: the default slot is the row. `start` (pulled right) and `end` (pulled left) actions `{ id, label, icon, tone, remove }`, listed from the edge inward. `look: 'icons' | 'labels'`, `label`.
791
+ - `SwipeActions`: `@action(action, ctx)` (ctx: `{ row, id, undo() }`; return false to keep the row) · `@open(row, side)` · `@close(row)`. A row with `remove: true` slides off and is hidden: drop it from your list when you are done.
792
+ - `full`, `full-at`, `single`, `haptic`, `as`. Template ref: `open(row, side)`, `close()`, `peek()`.
793
+
794
+ ### Kanban
795
+ Columns of cards you drag between columns or up and down. A picked-up card hangs from where you hold it.
796
+
797
+ ```vue
798
+ <Kanban
799
+ :columns="[{ id: 'todo', title: 'To do' }, { id: 'doing', title: 'Doing', limit: 3 }, { id: 'done', title: 'Done' }]"
800
+ :cards="tasks"
801
+ @move="(card, { to, index }) => moveTask(card.id, to, index)"
802
+ >
803
+ <template #card="{ card }"><TaskCard :task="card" /></template>
804
+ </Kanban>
805
+ ```
806
+ - Slot `#card="{ card }"` draws each card. Leave it out to get the built-in card (`tags`, `title`, `text`).
807
+ - A new `cards` is applied in place: new cards grow in, removed ones fold away, moved ones slide.
808
+ - `strict-limit`, `can-drop(card, column)`. `@move(card, { from, to, index })` (return false to put it back) · `@open(card)` · `@add(column)`.
809
+
810
+ ### Notifications
811
+ A notification feed, newest first and grouped by day. New ones slide in at the top, and unread dots fade when read.
812
+
813
+ ```vue
814
+ <Notifications
815
+ :items="notes"
816
+ :height="420"
817
+ @open="(n) => markRead(n.id)"
818
+ @action="async (n, action) => { await api.answer(n.id, action); return action === 'accept' ? 'Accepted' : 'Declined' }"
819
+ />
820
+ ```
821
+ - `items`: `{ id, time, title, body, person, icon, tone, read, actions, href }`. Changes are applied in place.
822
+ - `group`, `filter: 'all' | 'unread'`, `header`, `tabs`, `mark-all`, `dismissible`, `plain`. `@open(item)` · `@action(item, id)` · `@dismiss(item)` · `@change(unreadCount)`.
823
+
824
+ ### Activity
825
+ A timeline of what happened, newest first, with a line that draws down through the marks.
826
+
827
+ ```vue
828
+ <Activity :items="[{ id: 1, who: 'Pim', what: 'checked the Click in', icon: 'check', tone: 'good', time: returnedAt }]" marks="auto" locale="th" />
829
+ ```
830
+ - `items`: `{ id, time, who, what, title, detail, icon, tone }`. New ones at the top push the list down; others are set in place.
831
+ - `marks: 'auto' | 'icon' | 'avatar' | 'dot'`, `latest`, `max`, `intro` (`'view'`, true or false), `refresh` (s).
832
+
833
+ ### Pagination
834
+ Page numbers with previous / next, a page-size list and “21–30 of 240”.
835
+
836
+ ```vue
837
+ <Pagination v-model="page" v-model:page-size="pageSize" :total="bookingsTotal" />
838
+ ```
839
+ - `v-model` (or `default-value`): the page, from 1. `v-model:page-size` follows the size list. A smaller `total` moves to the last page and reports it.
840
+ - `siblings`, `boundaries`, `sizes`, `info`, `look: 'numbers' | 'simple'`, `compact`. `@change(page, pageSize)`.
841
+
842
+ ### Breadcrumbs
843
+ The path to the current page. Steps slide in and out when the path changes.
844
+
845
+ ```vue
846
+ <Breadcrumbs :items="[{ label: 'Fleet', href: '/fleet' }, { label: 'Scooters', href: '/fleet/scooters' }, { label: 'Honda Click' }]"
847
+ @navigate="(item, i, e) => { e.preventDefault(); router.push(item.href) }" />
848
+ ```
849
+ - `items`: `{ label, href, icon }`; the last one is the current page. A new `items` is set in place.
850
+ - `max`, `separator: 'chevron' | 'slash' | 'dot'`, `size`. `@navigate(item, index, event)`.
851
+
852
+ ### Skeleton
853
+ Grey placeholders in the shape of what is loading; the real content rises into place when it is ready.
854
+
855
+ ```vue
856
+ <Skeleton look="list" :rows="4" :loading="!riders" label="Riders">
857
+ <RiderList v-if="riders" :riders="riders" />
858
+ </Skeleton>
859
+ ```
860
+ - The default slot is the real content. `loading` (default true): false reveals it, true brings the placeholders back.
861
+ - `look: 'list' | 'card' | 'text' | 'table' | 'custom'`, `rows`, `avatar`, `media`, `lines`, `cols`, `shimmer`.
862
+
863
+ ### Alert
864
+ A message box in the page: info, success, warning or error, with actions and a close button.
865
+
866
+ ```vue
867
+ <Alert v-model:open="showError" tone="bad" title="Couldn't save the booking" dismissible
868
+ :actions="[{ label: 'Try again', primary: true, run: () => saveBooking() }]">
869
+ The bike is already booked on those days.
870
+ </Alert>
871
+ ```
872
+ - The default slot is the message. `tone`, `title`, `icon` and `actions` change in place (colours cross-fade, the text slides).
873
+ - `v-model:open`: false folds it away, true grows it back. Closing from inside (✕ or Esc) sets it to false and calls `@close`.
874
+ - `look: 'soft' | 'outline' | 'solid' | 'banner'`, `dismissible`, `icon` (false for none).
875
+
876
+ ## Action buttons
877
+
878
+ ### LikeButton
879
+
880
+ A like, star or bookmark button that pops (or fills) when it turns on, with a count that rolls up and down.
881
+
882
+ ```vue
883
+ <script setup>
884
+ import { ref } from 'vue';
885
+ const props = defineProps({ bike: Object });
886
+ const saved = ref(props.bike.saved);
887
+ const saves = ref(props.bike.saves);
888
+ // return the request: if it fails, the button (and saved / saves) goes back and shakes
889
+ const save = (on) => fetch(`/api/bikes/${props.bike.id}/save`, { method: on ? 'PUT' : 'DELETE' })
890
+ .then((r) => { if (!r.ok) throw new Error(String(r.status)); });
891
+ </script>
892
+
893
+ <template>
894
+ <LikeButton kind="bookmark" v-model="saved" v-model:count="saves" @change="save" />
895
+ </template>
896
+ ```
897
+
898
+ - `kind`: `'heart'` (default), `'star'` or `'bookmark'`.
899
+ - `v-model`: on or off (or `default-value` without v-model). `v-model:count` keeps your number in step.
900
+ - `count`: a number shows a rolling count; a new value (for example from the server) rolls to it.
901
+ - `label` / `on-label`, `icon-only`, `size` (`'sm'` `''` `'lg'`), `tone`, `format(n)`, `words`.
902
+ - `@change(pressed, count, handle)`: return a promise; if it fails, the button goes back with a shake (v-model too).
903
+ - Template ref → `{ pressed, count, set(on), toggle(), setCount(n), el }`.
904
+
905
+ ### BellSwitch
906
+
907
+ A notification switch: turning it on rings the bell, turning it off draws a slash across it. `BellButton` is the same component.
908
+
909
+ ```vue
910
+ <script setup>
911
+ import { ref, onMounted } from 'vue';
912
+ const alerts = ref(true);
913
+ const bell = ref(null);
914
+ onMounted(() => onNewBooking(() => bell.value?.ring()));
915
+ </script>
916
+
917
+ <template>
918
+ <BellSwitch ref="bell" v-model="alerts" label="Booking alerts" @change="(on) => saveSetting('booking-alerts', on)" />
919
+ </template>
920
+ ```
921
+
922
+ - `v-model`: on or off (or `default-value`).
923
+ - `label` (text, or the `#label` slot; text with `icon-only`), `icon-only`, `tone`, `words: { label, on, off }`.
924
+ - `@change(on, handle)`: return a promise; if it fails, it switches back with a shake (v-model too).
925
+ - Template ref → `{ on, set(on), toggle(), ring(), el }`: `ring()` when something new comes in.
926
+
927
+ ### PayButton
928
+
929
+ A checkout button: a card swipes through, "Processing", then "Paid" with a tick, or red "Try again" when the payment fails.
930
+
931
+ ```vue
932
+ <script setup>
933
+ const checkout = async () => {
934
+ const r = await fetch('/api/checkout', { method: 'POST', body: JSON.stringify(cart.value) });
935
+ if (!r.ok) throw new Error('Card declined');
936
+ return r.json(); // resolves = paid
937
+ };
938
+ </script>
939
+
940
+ <template>
941
+ <PayButton block @pay="checkout" @done="(receipt) => router.push(`/bookings/${receipt.id}`)" @fail="(e) => (cardError = String(e))">
942
+ Pay <b>฿{{ total }}</b>
943
+ </PayButton>
944
+ </template>
945
+ ```
946
+
947
+ - `@pay(handle)`: resolve = paid; throw, reject or return `false` = failed.
948
+ - `@done(result, handle)`, `@fail(error, handle)`.
949
+ - The label: the default slot, the `#label` slot or the `label` text. `variant` (`'dark'` default, `'primary'`), `size` (`'lg'` default), `block`, `icon` (`'card'`, `''` for none).
950
+ - `card` (the swipe, default on), `min-busy` (1.4 s), `back` (3 s; `0` stays "Paid"), `words`.
951
+ - Template ref → `{ state, pay(), reset(), el }`.
952
+
953
+ ### SpeedDial
954
+
955
+ A round + button that fans out a few labelled quick actions.
956
+
957
+ ```vue
958
+ <template>
959
+ <SpeedDial
960
+ fixed
961
+ :actions="[
962
+ { id: 'booking', label: 'New booking', icon: 'calendar' },
963
+ { id: 'bike', label: 'Add a bike', icon: 'plus' },
964
+ { id: 'note', label: 'Write a note', icon: 'edit' },
965
+ ]"
966
+ @select="(a) => router.push(`/new/${a.id}`)"
967
+ />
968
+ </template>
969
+ ```
970
+
971
+ - `actions`: `{ id, label, icon }` (icon name or `<svg>` string); a new list is swapped in place.
972
+ - `direction` (`'up'` / `'down'`), `side` (`'right'` / `'left'`), `labels`, `fixed`, `icon`, `words: { label, actions }`.
973
+ - `@select(action, handle)`, `@toggle(open, handle)`.
974
+ - Template ref → `{ isOpen, open(), close(), toggle(), setActions(list), el }`.
975
+
976
+ ### Typing
977
+
978
+ Three bouncing dots in a chat bubble, with "Pim is typing…".
979
+
980
+ ```vue
981
+ <template>
982
+ <Typing :visible="typingNames.length > 0" :names="typingNames" />
983
+ </template>
984
+ ```
985
+
986
+ - `visible`: shows or hides it in place (the row opens and closes, `collapse`).
987
+ - `names`: `'Pim'` or `['Pim', 'Mali']`; changes in place.
988
+ - `text`, `bubble`, `size` (`'sm'` `''` `'lg'`), `tone` (`'muted'` `'accent'` `'ink'`), `collapse`, `words: { anon, one, two, many }`.
989
+ - Template ref → `{ visible, text, show(), hide(), set(names), el }`.
990
+
991
+ ## Charts
992
+
993
+ ### LineChart
994
+ A line or area chart of one or more series over the same labels, with a crosshair, a tooltip and legend keys.
995
+ ```vue
996
+ <LineChart
997
+ label="Rental income by month"
998
+ :labels="['Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']"
999
+ :series="[{ name: 'Walk-in', data: walkIn }, { name: 'Booked online', data: online, tone: 'teal' }]"
1000
+ :height="240"
1001
+ :format="(v) => `฿${v.toLocaleString()}`"
1002
+ />
1003
+ ```
1004
+ - `labels`, `series: [{ name, data, tone, hidden }]` (`null` in data leaves a gap): new ones morph in place
1005
+ - `area`, `smooth`, `stacked`, `height`, `y-min`, `y-max`, `ticks`, `grid`, `dots` (`'hover'` / `true` / `false`), `tooltip`, `legend`
1006
+ - `format(v)`, `axis-format(v)`, `label`, `words`, `@point(index, info, chart)`
1007
+ - ref: `labels`, `series`, `update()`, `highlight(i)`, `toggle(name, on?)`, `el`
1008
+
1009
+ ### Donut
1010
+ Parts of a whole as a ring of slices, with the total in the middle.
1011
+ ```vue
1012
+ <Donut
1013
+ label="Bikes out today"
1014
+ :data="[{ label: 'Scooters', value: 48 }, { label: 'E-bikes', value: 20, tone: 'teal' }, { label: 'City bikes', value: 12 }]"
1015
+ centre="Bikes"
1016
+ @select="(i, item) => (filter = item ? item.label : null)"
1017
+ />
1018
+ ```
1019
+ - `data: [{ label, value, tone }]`: new data morphs the slices (matched by label)
1020
+ - `size`, `thickness`, `gap`, `legend` (`'right'` / `'bottom'` / `false`), `sort`, `format(v)`, `centre`, `label`, `words`
1021
+ - `@select(index, item, donut)` (index -1 when cleared); ref: `data`, `total`, `selected`, `set(data)`, `select(index | label | -1)`, `el`
1022
+
1023
+ ### Gauge
1024
+ One number on a half-circle dial, like today's bookings against a daily goal.
1025
+ ```vue
1026
+ <Gauge
1027
+ :value="todaySales" :max="12000" :goal="10000" label="Today's rentals"
1028
+ :format="(v) => `฿${v.toLocaleString()}`"
1029
+ :zones="[{ to: 4000, tone: 'bad' }, { to: 8000, tone: 'warn' }, { to: 12000, tone: 'good' }]"
1030
+ />
1031
+ ```
1032
+ - `value` (a plain prop, not v-model: the gauge only shows it): a new value swings the needle from where it is now
1033
+ - `min`, `max`, `goal`, `zones: [{ to, tone, label }]`, `tone`, `format(v)`, `label`, `size`, `needle`, `ends`, `words`
1034
+ - ref: `value`, `set(v)`, `el`
1035
+
1036
+ ### Leaderboard
1037
+ A ranked list with a bar under each row; when the numbers change the rows glide to their new ranks.
1038
+ ```vue
1039
+ <Leaderboard
1040
+ label="Tasks done this week" :max="5"
1041
+ :items="team.map((p) => ({ id: p.id, label: p.name, sub: p.role, value: p.done, avatar: { name: p.name } }))"
1042
+ />
1043
+ ```
1044
+ - `items: [{ id, label, value, sub, avatar }]`: new items glide, bars stretch and numbers count
1045
+ - `max` (rows shown, 0 = all), `format(v)`, `bars`, `medals`, `label`, `words`
1046
+ - ref: `items`, `set(items)`, `el`
1047
+
1048
+ ### Heatmap
1049
+ A calendar of small squares, one per day, darker on busier days.
1050
+ ```vue
1051
+ <script setup>
1052
+ const day = ref(null) // 'YYYY-MM-DD'
1053
+ </script>
1054
+ <template>
1055
+ <div style="padding: 4px">
1056
+ <Heatmap v-model="day" :data="bookings.map((b) => ({ date: b.day, value: b.count }))" :weeks="26"
1057
+ :format="(v) => `${v} bookings`" />
1058
+ </div>
1059
+ </template>
1060
+ ```
1061
+ - `data: [{ date, value }]` (`'YYYY-MM-DD'` or `Date`): new data re-shades every square in a ripple. (A function `(date) => number` is read once at the start.)
1062
+ - `v-model`: the picked day; a new value picks it in place, a click sets it to `'YYYY-MM-DD'` (`default-value` only at the start)
1063
+ - `@select(day, hm)` with `day = { date, value, level }`; `end` (default today), `weeks`, `week-start`, `levels`, `tone`, `format(v)`, `locale`, `words`
1064
+ - The scroll area reaches 4px past its box (room for the focus ring): give its container a little padding
1065
+ - ref: `value`, `set(data)`, `select(date | null)`, `el`
1066
+
1067
+ ## Text & scroll motion
1068
+
1069
+ ### TextReveal
1070
+
1071
+ A headline whose letters roll up out of a mask, one after another (`title()`); a new text plays again in place.
1072
+
1073
+ ```vue
1074
+ <template>
1075
+ <TextReveal as="h1" :stagger="0.022" :tilt="6">Bikes for every trip, {{ city }}</TextReveal>
1076
+ </template>
1077
+ ```
1078
+
1079
+ - The default slot is the text (or the `text` prop). A new text plays the reveal again (`retitle()`), on the same element.
1080
+ - `delay`, `stagger` (0.022), `tilt` (6°), `duration` (0.85).
1081
+ - `as` — the element (`'span'` by default: use `'h1'`, `'h2'`…).
1082
+
1083
+ ### Typewriter
1084
+
1085
+ Text typed letter by letter behind a caret; several phrases are deleted and typed in turn. Screen readers hear the whole list once.
1086
+
1087
+ ```vue
1088
+ <template>
1089
+ <h2>We rent <Typewriter :phrases="['scooters', 'city bikes', 'e-bikes']" caret="bar" /></h2>
1090
+ <Typewriter as="p" :loop="false" :speed="0.03">Your bike is booked for {{ day }} at 9 am.</Typewriter>
1091
+ </template>
1092
+ ```
1093
+
1094
+ - `phrases` — the list (or one phrase as the default slot). A new list (or slot text) deletes the current phrase and types the new one.
1095
+ - `speed` (0.06 s a letter), `jitter`, `erase-speed`, `erase` (`'backspace'` | `'select'`), `hold`, `gap`, `delay`, `loop`.
1096
+ - `caret` (`'bar'` | `'block'` | `'underscore'` | `false`), `locale`, `label`, `when-visible`, `paused`.
1097
+ - `@phrase(i, text)`. Template ref → `{ phrase, play(), pause(), restart(), set(list), el }`.
1098
+
1099
+ ### Rotator
1100
+
1101
+ One word in a sentence keeps changing; its slot glides to the new width so the sentence moves over smoothly.
1102
+
1103
+ ```vue
1104
+ <template>
1105
+ <h2>Rent a <Rotator :words="['scooter', 'city bike', 'e-bike']" effect="roll" pill /> by the hour</h2>
1106
+ </template>
1107
+ ```
1108
+
1109
+ - `words` — the list. A new list starts again from the first word.
1110
+ - `effect` (`'roll'` | `'drop'` | `'slide'` | `'blur'` | `'letters'`), `every` (2.2 s), `duration`, `ease`, `stagger`.
1111
+ - `pill` — a soft highlight box behind the word. `index` — show this word; `:auto="false"` to drive it yourself; `paused`.
1112
+ - `@change(i, word)`. Template ref → `{ index, next(), go(i), play(), pause(), set(words), el }`.
1113
+
1114
+ ### Shine
1115
+
1116
+ A slanted band of light sweeps across the letters, like light on a shiny sign. The text stays real text.
1117
+
1118
+ ```vue
1119
+ <template>
1120
+ <Shine as="h2" look="gradient" trigger="loop">Summer rides, 20% off</Shine>
1121
+ <Shine look="ink" trigger="hover" tabindex="0">Loading your bookings…</Shine>
1122
+ </template>
1123
+ ```
1124
+
1125
+ - `look` (`'gradient'` | `'ink'` | `'color'`), `trigger` (`'loop'` | `'view'` | `'hover'`).
1126
+ - `duration` (1.4), `repeat-delay` (1.8), `delay`, `ease`, `angle` (110°), `width` (12), `color`, `as` (`'span'`).
1127
+ - CSS only, no Vue needed: `<span class="gk-shine gk-shine--ink gk-shine--loop">…</span>`.
1128
+
1129
+ ### Highlighter
1130
+
1131
+ A marker stroke draws behind the words in `<mark>`, one after another, when the paragraph scrolls into view.
1132
+
1133
+ ```vue
1134
+ <template>
1135
+ <Highlighter tone="amber">
1136
+ Every rental comes with <mark>a free helmet</mark> and <mark>a lock</mark>.
1137
+ </Highlighter>
1138
+ </template>
1139
+ ```
1140
+
1141
+ - `look` (`'marker'` | `'underline'`), `tone` (`accent amber green rose sky violet`) or `color`.
1142
+ - `trigger` (`'view'` | `'now'` | `'manual'`), `threshold` (0.6), `once`, `duration`, `stagger`, `delay`, `ease`, `selector`, `as` (`'p'`).
1143
+ - `active` — with `trigger="manual"`: `true` draws the strokes, `false` clears them. A new slot text is marked again.
1144
+
1145
+ ### ScrollReveal
1146
+
1147
+ Blocks (or their words) wait out of sight and arrive as they scroll into view: fade, rise, slide, zoom or blur.
1148
+
1149
+ ```vue
1150
+ <template>
1151
+ <ScrollReveal effect="rise"><BookingSummary :booking="b" /></ScrollReveal>
1152
+
1153
+ <ScrollReveal items=":scope > article" effect="slide" :x="-40">
1154
+ <article v-for="s in steps" :key="s.id"><h4>{{ s.title }}</h4><p>{{ s.text }}</p></article>
1155
+ </ScrollReveal>
1156
+
1157
+ <ScrollReveal as="p" words effect="blur">Pick a bike, choose your days and ride.</ScrollReveal>
1158
+ </template>
1159
+ ```
1160
+
1161
+ - Without `items` the element itself is revealed (and hidden in the server HTML until then, no flash).
1162
+ `items` — a selector inside: each match is revealed, top to bottom; items added later are revealed too.
1163
+ - `effect`, `words`, `y`, `x`, `scale`, `blur`, `duration`, `stagger`, `word-stagger`, `delay`, `ease`.
1164
+ With `words`, a new slot text is joined back before Vue draws it, then split and revealed again (links inside keep their `@click`).
1165
+ - `once` (false = play every time), `threshold` (0.2), `root-margin`, `root` (the scrolling box: element, template ref or selector).
1166
+ - `@enter(el)`, `@leave(el)`.
1167
+
1168
+ ### BlurIn
1169
+
1170
+ The words of a paragraph come into focus one after another, right away (for a hero already on screen).
1171
+
1172
+ ```vue
1173
+ <template>
1174
+ <BlurIn as="p" :blur="12" :stagger="0.05">Slow mornings, fresh coffee and a bike waiting at the door.</BlurIn>
1175
+ </template>
1176
+ ```
1177
+
1178
+ - `blur` (10 px), `y` (25), `duration` (0.7), `stagger` (0.04), `delay`, `ease`, `as` (`'p'`). A new text plays again.
1179
+
1180
+ ### ScrollProgress
1181
+
1182
+ A thin line that fills as the page (or a scrolling box) is read.
1183
+
1184
+ ```vue
1185
+ <script setup>
1186
+ import { ref } from 'vue';
1187
+ const panel = ref(null);
1188
+ const read = ref(0);
1189
+ </script>
1190
+
1191
+ <template>
1192
+ <ScrollProgress style="position: sticky; top: 0" />
1193
+ <div ref="panel" class="panel">…</div>
1194
+ <ScrollProgress :root="panel" @change="(p) => (read = Math.round(p * 100))" />
1195
+ </template>
1196
+ ```
1197
+
1198
+ - `root` — the scrolling box (element, template ref or selector; default the page). `@change(progress)` with 0…1.
1199
+ - Colour and height: `--gk-scroll-progress-c`, `--gk-scroll-progress-h`.
1200
+
1201
+ ### Odometer
1202
+
1203
+ A number that rolls digit by digit like a car's meter; only the digits that change spin.
1204
+
1205
+ ```vue
1206
+ <template>
1207
+ <Odometer :value="yearly ? 1990 : 2490" :format="{ style: 'currency', currency: 'THB', minimumFractionDigits: 0, maximumFractionDigits: 0 }" locale="th-TH" />
1208
+ </template>
1209
+ ```
1210
+
1211
+ - `value` — a number (or a ready-made string). A new value rolls in place.
1212
+ - `format` (Intl options or `(v) => text`), `locale`, `duration` (0.9), `stagger` (0.06), `direction` (`'auto'` | `'up'` | `'down'`), `ease`.
1213
+ - `from` — roll in from this value on mount.
1214
+
1215
+ ### CountUp
1216
+
1217
+ A number that counts up on mount, and from the number on screen to the new one when it changes.
1218
+
1219
+ ```vue
1220
+ <template>
1221
+ <div class="gk-kpi"><small>Revenue today</small><b><CountUp :value="stats.revenue" prefix="฿" tick /></b></div>
1222
+ <CountUp :value="4.8" :decimals="1" suffix=" / 5" />
1223
+ </template>
1224
+ ```
1225
+
1226
+ - `value`, `from` (0), `duration` (1.2), `delay`.
1227
+ - `prefix`, `suffix`, `decimals`, `locale` ('en-US'), or your own `format(v)`.
1228
+ - `tick` — tint the number green going up, red going down.
1229
+
1230
+ ## Motion wrappers
1231
+
1232
+ ### Rise
1233
+
1234
+ Children that arrive one after another: they fade in and float up (or slide, or drop in like dealt cards).
1235
+
1236
+ ```vue
1237
+ <template>
1238
+ <Rise class="gk-grid" :stagger="0.05">
1239
+ <BikeCard v-for="bike in bikes" :key="bike.id" :bike="bike" />
1240
+ </Rise>
1241
+
1242
+ <Rise kind="slide" :x="-24" as="ul" class="list">
1243
+ <li v-for="b in bookings" :key="b.id">{{ b.rider }} · {{ b.bike }}</li>
1244
+ </Rise>
1245
+ </template>
1246
+ ```
1247
+
1248
+ - `kind`: `rise` (default) · `slide` · `deal` · `reveal` (a small fade-down of the element itself, e.g. an accordion body).
1249
+ - `y`, `x`, `stagger`, `delay`, `duration`, `tilt` (deal) — the same options as `rise()` / `slide()` / `deal()`.
1250
+ - Children added later (a new booking in the list) arrive the same way; `:animate-new="false"` turns that off.
1251
+ - `items` — a selector inside to animate instead of the direct children; `as` — the element (`div`).
1252
+
1253
+ ### Magnetic
1254
+
1255
+ The element leans toward the pointer and springs back when it leaves (mouse and trackpad only).
1256
+
1257
+ ```vue
1258
+ <template>
1259
+ <Magnetic :strength="0.3">
1260
+ <Button variant="primary" icon-right="arrowR">Book a bike</Button>
1261
+ </Magnetic>
1262
+ </template>
1263
+ ```
1264
+
1265
+ - `strength` (0.2) and `strength-y` (0.28): how far it follows the pointer; `magnet` multiplies it for this element.
1266
+ - It renders an inline-block `<span class="gk-magnetic">` around your content; `as="a"` makes the element itself magnetic.
1267
+
1268
+ ### Lift
1269
+
1270
+ The element rises a few pixels while the pointer is over it (mouse and trackpad only).
1271
+
1272
+ ```vue
1273
+ <template>
1274
+ <Lift as="article" :y="-6" class="gk-card">
1275
+ <h3>Old town tour</h3>
1276
+ <p>2 hours · 3 stops</p>
1277
+ </Lift>
1278
+ </template>
1279
+ ```
1280
+
1281
+ - `y` — pixels it moves (-4); `as` — the element (`div`).
1282
+
1283
+ ### Tilt
1284
+
1285
+ A card that leans toward the pointer in 3D, with a soft glare; children with `data-depth` float above it.
1286
+
1287
+ ```vue
1288
+ <template>
1289
+ <Tilt :max="10" glare as="article" class="gk-card">
1290
+ <img data-depth="40" :src="bike.photo" :alt="bike.name" />
1291
+ <h3 data-depth="20">{{ bike.name }}</h3>
1292
+ </Tilt>
1293
+ </template>
1294
+ ```
1295
+
1296
+ - `max` (12°), `scale` (1.03), `perspective` (900), `glare` (true), `parallax` (0.25), `follow` (0.35 s), `spring` (1 s).
1297
+ - Mouse and trackpad only; with reduced motion it stays still.
1298
+
1299
+ ### Spotlight
1300
+
1301
+ A soft light follows the pointer across a group of cards and lights up their edges.
1302
+
1303
+ ```vue
1304
+ <template>
1305
+ <Spotlight class="plans" :size="300">
1306
+ <div v-for="plan in plans" :key="plan.id" class="gk-card">
1307
+ <h3>{{ plan.name }}</h3>
1308
+ <p>{{ plan.price }} ฿ / day</p>
1309
+ </div>
1310
+ </Spotlight>
1311
+ </template>
1312
+ ```
1313
+
1314
+ - `size` (240 px), `follow` (0.2 s), `border` (true), `fill` (true), `focus` (true: a focused card pulls the light onto itself).
1315
+ - `items` — a selector (or elements) for the cards; by default the children.
1316
+
1317
+ ### Marquee
1318
+
1319
+ An endless sideways strip of logos or items; hover or focus slows it to a stop.
1320
+
1321
+ ```vue
1322
+ <script setup>
1323
+ import { ref } from 'vue';
1324
+ const pause = ref(null);
1325
+ const strip = ref(null); // strip.value.pause(), .play(), .toggle(), .paused, .refresh(), .el
1326
+ </script>
1327
+
1328
+ <template>
1329
+ <Marquee ref="strip" aria-label="Shops that ride with us" :speed="50" :gap="48" :button="pause">
1330
+ <img v-for="p in partners" :key="p.id" :src="p.logo" :alt="p.name" height="28" />
1331
+ </Marquee>
1332
+ <button ref="pause" class="gk-btn gk-btn--sm">⏸</button>
1333
+ </template>
1334
+ ```
1335
+
1336
+ - Each child becomes one item (`<li>` in a `<ul>`; `list-as` to change). New items are measured again.
1337
+ - `speed` (50 px/s), `direction`, `gap`, `fade` change in place; `pause-on-hover` (true), `paused`.
1338
+ - `button` — a pause / play button (element, template ref or selector); `words` — its labels.
1339
+ - Template ref → `{ play(), pause(), toggle(), paused, refresh(), el }`.
1340
+
1341
+ ## Interactive effects
1342
+
1343
+ ### Indicator
1344
+
1345
+ A box with a stretchy pill (or an underline) that slides to the active item when `active` changes.
1346
+
1347
+ ```vue
1348
+ <script setup>
1349
+ import { ref } from 'vue';
1350
+ const page = ref('bikes');
1351
+ </script>
1352
+
1353
+ <template>
1354
+ <Indicator as="nav" :active="page" :radius="99" class="gk-menu" style="display: flex; gap: 4px">
1355
+ <button v-for="p in ['today', 'bikes', 'returns']" :key="p" type="button"
1356
+ :aria-current="page === p ? 'page' : undefined" @click="page = p">{{ p }}</button>
1357
+ </Indicator>
1358
+ </template>
1359
+ ```
1360
+
1361
+ - The active item is the child with `aria-current`, `aria-selected="true"`, `aria-pressed="true"` or `.gk-is-active` (`selector` to change).
1362
+ - `radius` (13; 99 = round ends), `line` (an underline), `lead` / `trail` / `cross` (seconds per edge).
1363
+ - `pill-class` / `pill-style` style the pill (with `pill-class` the accent background is left off).
1364
+
1365
+ ### useIndicator
1366
+
1367
+ The same pill on a menu you draw yourself: put the returned template ref on a `<span>` inside it.
1368
+
1369
+ ```vue
1370
+ <script setup>
1371
+ import { ref } from 'vue';
1372
+ import { useIndicator } from '@gecko-ui-kit/vue';
1373
+ const view = ref('week');
1374
+ const pill = useIndicator(view, { radius: 99 });
1375
+ </script>
1376
+
1377
+ <template>
1378
+ <nav class="gk-menu">
1379
+ <span ref="pill" class="gk-menu__pill" />
1380
+ <button v-for="v in ['day', 'week', 'month']" :key="v" :aria-pressed="String(view === v)" @click="view = v">{{ v }}</button>
1381
+ </nav>
1382
+ </template>
1383
+ ```
1384
+
1385
+ - `useIndicator(active, options)` — `active` is a ref or getter; options as for `Indicator` (an object, ref or getter).
1386
+
1387
+ ### PageSwap
1388
+
1389
+ A page transition: when `swap-key` changes, the old page steps back and fades, then the new one slides in.
1390
+
1391
+ ```vue
1392
+ <template>
1393
+ <PageSwap :swap-key="route.path" :dir="forward ? 1 : -1" @swap="(view) => rise(view.querySelectorAll('.gk-card'))">
1394
+ <RouterView />
1395
+ </PageSwap>
1396
+ </template>
1397
+ ```
1398
+
1399
+ - `dir` — 1 forward (new page from the right), -1 back.
1400
+ - `leave` — blocks that fade and drop on the way out (`.gk-card, .gk-kpi, .lane, [data-swap]`); `head` — header parts that lift away.
1401
+ - `timing` — `{ out, in, shift, enter }` for this swap only. `@swap(view)` runs once the new page is in.
1402
+
1403
+ ### useFeedback · useFlash · useTick
1404
+
1405
+ Small reactions: pop a pressed button, shake a form, bounce a total that changed, tint a number up or down.
1406
+
1407
+ ```vue
1408
+ <script setup>
1409
+ import { ref, computed } from 'vue';
1410
+ import { useFeedback, useFlash, useTick } from '@gecko-ui-kit/vue';
1411
+ const days = ref(2);
1412
+ const total = computed(() => days.value * 320);
1413
+ const { ref: form, shake, pop } = useFeedback();
1414
+ const totalEl = useFlash(total);
1415
+ const daysEl = useTick(days);
1416
+ </script>
1417
+
1418
+ <template>
1419
+ <form ref="form" @submit.prevent="days > 14 && shake()">
1420
+ <button type="button" @click="(e) => { pop(e); days++ }">+1 day</button>
1421
+ <b ref="daysEl">{{ days }}</b> days · <b ref="totalEl">฿{{ total }}</b>
1422
+ </form>
1423
+ </template>
1424
+ ```
1425
+
1426
+ - `useFeedback()` → `{ ref, pop, shake, wiggle, flash, tick(up) }`; each runs on `ref`, or on what you pass (an element, a template ref or an event).
1427
+ - `useFlash(value)` / `useTick(value)` — a ref or getter; they return the template ref to put on the element.
1428
+
1429
+ ### ConfettiButton · useConfetti · confetti
1430
+
1431
+ A burst of paper confetti from a button (or from any element or point).
1432
+
1433
+ ```vue
1434
+ <script setup>
1435
+ import { useConfetti } from '@gecko-ui-kit/vue';
1436
+ const fire = useConfetti({ count: 150 });
1437
+ </script>
1438
+
1439
+ <template>
1440
+ <ConfettiButton variant="primary" icon="sparkle" :count="150" @click="pay">Pay ฿640</ConfettiButton>
1441
+ <Button @click="(e) => fire(e)">Celebrate</Button>
1442
+ </template>
1443
+ ```
1444
+
1445
+ - `ConfettiButton` is a `Button` (same props); call `event.preventDefault()` in `@click` to skip the burst; `@done` when it has landed.
1446
+ - Options: `count`, `spread`, `angle`, `velocity`, `colors`, `shapes`, `gravity`, `duration`, `z-index`, `reduced`.
1447
+ - `useConfetti(options)` → `fire(origin?, options?)`; bursts still flying stop on unmount. `confetti(origin, options)` is the plain function.
1448
+
1449
+ ### Sortable
1450
+
1451
+ A list you reorder by dragging (mouse at once, touch after a long press); the card lifts, the others slide aside, it lands with a squash.
1452
+
1453
+ ```vue
1454
+ <script setup>
1455
+ import { ref } from 'vue';
1456
+ const lanes = ref({ todo: [{ id: 't1', title: 'Check brakes' }], done: [] });
1457
+ </script>
1458
+
1459
+ <template>
1460
+ <Sortable v-for="(tasks, lane) in lanes" :key="lane" v-model="lanes[lane]" group="board" :get-key="(t) => t.id" class="lane">
1461
+ <h4>{{ lane }}</h4>
1462
+ <template #item="{ item }"><TaskCard :task="item" /></template>
1463
+ </Sortable>
1464
+ </template>
1465
+ ```
1466
+
1467
+ - `v-model` is the list (or `default-value` to let it keep its own order); `@reorder(next, { item, from, to, fromList, toList })`.
1468
+ - `#item="{ item, index }"` draws one item; the default slot is drawn before the items, inside the drop zone (a lane title).
1469
+ - `group` — lists with the same group pass items to each other; `@item-click(item)` — a press without moving.
1470
+ - `get-key`, `as` / `item-as` / `item-class`, `lift`, `squash` (true), `rotate` (3), `handle` (a grip selector).
1471
+
1472
+ ### ThemeToggle · useTheme
1473
+
1474
+ A round moon / sun button that switches light ↔ dark with a circular reveal from the button, and saves the choice.
1475
+
1476
+ ```vue
1477
+ <script setup>
1478
+ import { useTheme } from '@gecko-ui-kit/vue';
1479
+ const [theme, setTheme] = useTheme();
1480
+ </script>
1481
+
1482
+ <template>
1483
+ <ThemeToggle @change="(t) => saveSetting('theme', t)" />
1484
+ <Button @click="(e) => setTheme('dark', e)">Night mode</Button>
1485
+ <span>{{ theme }}</span>
1486
+ </template>
1487
+ ```
1488
+
1489
+ - `storage-key` (`gecko:theme`; `''` = don't save), `duration` (450 ms), `easing`, `label`, `size`.
1490
+ - `useTheme(options)` → `[theme, setTheme(next | (current) => next, fromElementOrEvent?)]`; `theme` is `'light'` on the server and the real theme once mounted.
1491
+
1492
+ ### SendButton
1493
+
1494
+ The plane winds back and flies off, then "Sent" rolls in with a tick.
1495
+
1496
+ ```vue
1497
+ <template>
1498
+ <SendButton variant="primary" @click="sendInvoice">Send invoice</SendButton>
1499
+ <SendButton :sent="status === 'sent'" type="submit" />
1500
+ </template>
1501
+ ```
1502
+
1503
+ - A click plays it and it comes back after `back` seconds (2.4; 0 = stays). With `sent` it follows the prop instead.
1504
+ - `done` (Sent), `path` (`up` · `straight` · `loop`), `trail`, `duration`, `icon`; `@done(button)`.
1505
+
1506
+ ### DeleteButton
1507
+
1508
+ The bin opens and eats its own label letter by letter, chews, and "Deleted" rises in.
1509
+
1510
+ ```vue
1511
+ <template>
1512
+ <DeleteButton variant="danger" :back="0" @done="removeBooking(id)">Delete</DeleteButton>
1513
+ </template>
1514
+ ```
1515
+
1516
+ - The slot is the label (text). `deleted` follows a prop instead of the click; `done`, `order` (`first` · `last`), `chew`, `back`.
1517
+ - `@done(button)` when "Deleted" is in: remove the row there.
1518
+
1519
+ ### DownloadButton
1520
+
1521
+ The button's own outline is the progress bar; it glows and ticks when done, shakes red when it fails.
1522
+
1523
+ ```vue
1524
+ <template>
1525
+ <DownloadButton variant="primary" :progress="progress" :state="failed ? 'failed' : progress === 1 ? 'done' : undefined"
1526
+ @click="downloadReport">Download report</DownloadButton>
1527
+ </template>
1528
+ ```
1529
+
1530
+ - `progress` 0–1 (null = size unknown: a segment chases round); `state` `idle` · `loading` · `done` · `failed`.
1531
+ - `label(progress)`, `wait` (Preparing…), `done`, `fail`, `back`, `width`.
1532
+
1533
+ ### HoldButton
1534
+
1535
+ Press and hold to confirm: colour floods the button and only a full hold runs the action.
1536
+
1537
+ ```vue
1538
+ <template>
1539
+ <HoldButton tone="bad" hint="Hold to delete" done="Deleted" @confirm="deleteBike(bike.id)">Delete bike</HoldButton>
1540
+ <HoldButton look="ring" tone="accent" icon="trash">Remove</HoldButton>
1541
+ </template>
1542
+ ```
1543
+
1544
+ - `look` (`fill` · `ring`: a circle round a round icon button), `tone` (`bad` · `accent` · `good` · `warn`), `duration` (1.2 s).
1545
+ - `hint`, `done`, `back`, `haptic`, `icon`; `confirmed` confirms or resets it from a prop.
1546
+ - `@confirm(button, handle)`; `@cancel(button, handle, progress)` when let go too early.
1547
+
1548
+ ### ExpandSearch
1549
+
1550
+ A round magnifier that stretches into a search field, types its hint in and draws a ×.
1551
+
1552
+ ```vue
1553
+ <template>
1554
+ <ExpandSearch v-model="query" placeholder="Search bikes…" :width="280" shortcut="/" @search="findBikes" />
1555
+ </template>
1556
+ ```
1557
+
1558
+ - `v-model` (or `default-value`) is the text, `@change(text)` on every change; `@search(text)` on Enter.
1559
+ - `v-model:open` (or `default-open`), `@open`, `@close`. Escape clears, then closes.
1560
+ - `width`, `typing`, `auto-close`, `look` (`outline` · `quiet`), `size` (`md` · `sm`), `name`, `label`, `close-label`.
1561
+
1562
+ ### LiquidTabs
1563
+
1564
+ A phone tab bar where a liquid bubble moves to the active tab.
1565
+
1566
+ ```vue
1567
+ <template>
1568
+ <LiquidTabs v-model="tab" label="Main" :items="[
1569
+ { label: 'Home', icon: 'home' }, { label: 'Bikes', icon: 'box' },
1570
+ { label: 'Trips', icon: 'calendar' }, { label: 'Me', icon: 'user' },
1571
+ ]" />
1572
+ </template>
1573
+ ```
1574
+
1575
+ - `v-model` is the active index (or `default-value`); `@change(index, tabElement)`.
1576
+ - `mode` (`dip` · `glide`), `splash`, `labels` (false: icons only), `goo`.
1577
+ - Items with `href` are links; `:link-as="NuxtLink"` renders them with your router (it gets `to`). `#label="{ item, index }"` draws a label.
1578
+
1579
+ ### Burger
1580
+
1581
+ Three lines that turn into an ✕ and back, for the button that opens a phone menu.
1582
+
1583
+ ```vue
1584
+ <template>
1585
+ <Burger v-model:open="menuOpen" controls="main-menu" />
1586
+ <nav id="main-menu" :hidden="!menuOpen">…</nav>
1587
+ </template>
1588
+ ```
1589
+
1590
+ - `v-model:open` (or `default-open`); a click or Escape asks for the other state (`@toggle(open, button)`).
1591
+ - `words` (`{ open, close }` labels), `duration` (0.45), `escape` (true), `size`, `icon-class`.
1592
+
1593
+ ## Overlays
1594
+
1595
+ Things that pop up over the page. The vanilla `@gecko-ui-kit/overlays` code still opens, places, animates and
1596
+ stacks them; your slot content is teleported inside. Open state is `v-model:open`: when an overlay closes itself
1597
+ (✕, scrim, Esc), `open` turns false first and then its event (`@close`, `@end`…) runs. Esc closes the newest one
1598
+ (installed once, the first time one opens). Nothing is drawn on the server; they wake up in the browser.
1599
+
1600
+ ### Modal
1601
+
1602
+ A dialog in the middle of the screen that zooms out of the button that opened it (a bottom sheet on phones).
1603
+
1604
+ ```vue
1605
+ <script setup>
1606
+ const open = ref(false);
1607
+ const editBtn = ref(null);
1608
+ </script>
1609
+
1610
+ <template>
1611
+ <Button ref="editBtn" icon="edit" @click="open = true">Edit bike</Button>
1612
+ <Modal v-model:open="open" :anchor="editBtn" title="Edit bike" sub="Honda Click · กข 1234">
1613
+ <BikeForm :bike="bike" />
1614
+ <template #footer>
1615
+ <Button @click="open = false">Cancel</Button>
1616
+ <Button variant="primary" @click="save">Save</Button>
1617
+ </template>
1618
+ </Modal>
1619
+ </template>
1620
+ ```
1621
+
1622
+ - `v-model:open`, `@close` — closing from inside (✕, scrim, Esc) sets `open` to false, then calls `@close`.
1623
+ - `title`, `sub` — text props, or `#title` / `#sub` slots for richer content; they may change while it is open.
1624
+ - `size` — `''`, `'sm'` or `'lg'`. `anchor` — element, template ref or component it zooms out of.
1625
+ - `words` — `{ close }`, the ✕ button's label for screen readers (default `'Close'`), e.g. `:words="{ close: 'ปิด' }"`.
1626
+ - Slots: default (the body), `#footer` (buttons at the bottom), `#title`, `#sub`.
1627
+
1628
+ ### Drawer
1629
+
1630
+ A panel that slides in from the side (a bottom sheet on phones); its content drifts up as it lands.
1631
+
1632
+ ```vue
1633
+ <Drawer v-model:open="riderOpen" :title="rider.name" :sub="'Rider since ' + rider.since" side="right">
1634
+ <template #head><span class="gk-av gk-av--teal">{{ rider.initials }}</span></template>
1635
+ <RiderBookings :id="rider.id" />
1636
+ <template #footer><Button variant="primary">Message</Button></template>
1637
+ </Drawer>
1638
+ ```
1639
+
1640
+ - `v-model:open`, `@close`, `title`, `sub`, `words` — as in Modal.
1641
+ - `head` — something before the title (text prop, or the `#head` slot for an avatar). `side` — `'right'` (default) or `'left'`.
1642
+ - Opening a drawer closes any other drawer (its `open` turns false and its `@close` runs).
1643
+ - Slots: default (the body), `#head`, `#title`, `#sub`, `#footer`.
1644
+
1645
+ ### confirm / useConfirm
1646
+
1647
+ An “are you sure?” dialog you `await`: `true` for OK, `false` for Cancel, ✕, scrim or Esc.
1648
+
1649
+ ```vue
1650
+ <script setup>
1651
+ import { useConfirm, toast } from '@gecko-ui-kit/vue';
1652
+ const confirm = useConfirm();
1653
+
1654
+ async function cancelBooking(b) {
1655
+ if (!(await confirm({ title: `Cancel booking #${b.id}?`, body: 'The rider gets a full refund.', ok: 'Cancel booking', danger: true }))) return;
1656
+ await api.cancel(b.id);
1657
+ toast('Booking cancelled', { tone: 'good' });
1658
+ }
1659
+ </script>
1660
+ ```
1661
+
1662
+ - `title`, `body`, `ok`, `cancel` — plain text (safe for your data). `danger` — red OK button. `anchor` — zooms out of it.
1663
+ - `confirm()` works anywhere in the browser; `useConfirm()` (call it in `setup`) also closes a dialog that is still
1664
+ open when the component unmounts.
1665
+
1666
+ ### Popover
1667
+
1668
+ A small panel that pops out of its trigger (the default slot: one element), with its origin pointing back at it.
1669
+
1670
+ ```vue
1671
+ <Popover align="end" label="Share" class-name="pop--wide">
1672
+ <Button icon="send">Share</Button>
1673
+ <template #content="{ close }">
1674
+ <ShareBooking :id="booking.id" @copied="close" />
1675
+ </template>
1676
+ </Popover>
1677
+ ```
1678
+
1679
+ - `#content` slot (gets `{ close }`), or a `content` text prop.
1680
+ - Clicking the trigger toggles it; a click outside, Esc or a resize closes it.
1681
+ - `v-model:open` to control it, or `default-open`. `@open-change(open)` after every change.
1682
+ - `align` — `'start' | 'center' | 'end'`. `class-name` (a class on the panel, e.g. `pop--wide`), `label`.
1683
+ - Template ref → `{ open(), close(), isOpen, el }`.
1684
+
1685
+ ### Menu
1686
+
1687
+ A popover with a ready-made list of actions that slide in; ↑ ↓ move between them.
1688
+
1689
+ ```vue
1690
+ <Menu align="end" :items="[
1691
+ { section: 'Booking' },
1692
+ { icon: 'edit', label: 'Edit', kbd: 'E', run: () => edit(b) },
1693
+ { icon: 'copy', label: 'Duplicate', run: () => duplicate(b) },
1694
+ '-',
1695
+ { icon: 'trash', label: 'Cancel booking', danger: true, run: () => cancelBooking(b) },
1696
+ ]">
1697
+ <IconButton icon="more" label="More" />
1698
+ </Menu>
1699
+ ```
1700
+
1701
+ - `items` — `{ label, icon, kbd, danger, run(trigger) }`, `{ section: 'Heading' }`, or `'-'` for a line. Labels are plain text.
1702
+ - `@select(item, index)` — after any action (after its `run`). `align`, `class-name`, `label`.
1703
+ - Template ref → `{ open(), close(), isOpen }`.
1704
+
1705
+ ### ContextMenu
1706
+
1707
+ The menu you get with a right-click, a long-press on touch screens or Shift+F10. It grows from the pointer and has submenus and ticks.
1708
+
1709
+ ```vue
1710
+ <script setup>
1711
+ const rowMenu = (event, row) => [
1712
+ { section: `Booking #${row.dataset.id}` },
1713
+ { icon: 'edit', label: 'Edit', kbd: 'E', run: () => edit(row.dataset.id) },
1714
+ { label: 'Move to', items: bikes.value.map((bike) => ({ label: bike.name, run: () => move(row.dataset.id, bike.id) })) },
1715
+ { label: 'Paid', checked: isPaid(row.dataset.id), run: (_el, item) => setPaid(row.dataset.id, item.checked) },
1716
+ '-',
1717
+ { icon: 'trash', label: 'Cancel', danger: true, run: () => cancelBooking(row.dataset.id) },
1718
+ ];
1719
+ </script>
1720
+
1721
+ <template>
1722
+ <table>
1723
+ <ContextMenu as="tbody" selector="tr[data-id]" :items="rowMenu">
1724
+ <tr v-for="b in bookings" :key="b.id" :data-id="b.id">…</tr>
1725
+ </ContextMenu>
1726
+ </table>
1727
+ </template>
1728
+ ```
1729
+
1730
+ - `items` — a list, or `(event, el) => list` on every open (return `[]` to get the browser's own menu).
1731
+ Rows: `{ label, icon, kbd, hint, disabled, danger, checked, items, run(el, item) }`, `{ section }`, `'-'`.
1732
+ - `checked` rows flip on a copy (never your data): `run` / `@select` get the new value in `item.checked`.
1733
+ - `selector`, `long-press` (ms, 0 = off), `native-on-shift`, `icons`, `shortcuts`, `words: { label }`,
1734
+ `@select(item, el)`, `@open(el)`, `@close(el)`.
1735
+ - `as` — the wrapper element (default `div`). Template ref → `{ open(x, y, el?), close(), isOpen, menu, el }`.
1736
+
1737
+ ### Tooltip
1738
+
1739
+ A small label that fades in under (or beside) an element on hover or keyboard focus. Hidden on phones.
1740
+
1741
+ ```vue
1742
+ <Tooltip text="Edit booking"><IconButton icon="edit" label="Edit booking" /></Tooltip>
1743
+ <Tooltip side="right">
1744
+ <template #text>Somchai K.<br />Mechanic</template>
1745
+ <span class="gk-av gk-av--teal" tabindex="0">SK</span>
1746
+ </Tooltip>
1747
+ ```
1748
+
1749
+ - `text` — a string (a `\n` makes a second line), or the `#text` slot. `side` — `'below'` (default) or `'right'`.
1750
+ - `disabled` — turn it off for now. Inside an element with `data-tips-right` it opens to the right.
1751
+ - The default slot is the element it explains (one element).
1752
+
1753
+ ### toast
1754
+
1755
+ A short message that pops up at the bottom and goes away by itself. A plain function: call it from anywhere in the browser.
1756
+
1757
+ ```js
1758
+ import { toast } from '@gecko-ui-kit/vue';
1759
+
1760
+ toast('Booking saved', { tone: 'good' });
1761
+ toast('Bike moved to the workshop', { icon: 'tool', undo: () => moveBack(bike) });
1762
+ const close = toast('Uploading photos…', { duration: 60000 }); // close() when done
1763
+ ```
1764
+
1765
+ - `tone` — `''`, `'good'`, `'warn'` or `'bad'`. `icon` — an icon name. `duration` — ms (default 4200).
1766
+ - `undo` — adds an Undo button; `undoLabel`, `undoneText`. The text is shown as plain text (safe for your data).
1767
+
1768
+ ### CookieBanner
1769
+
1770
+ Asks once which cookies a visitor allows, remembers the answer and stays away until you raise `version`.
1771
+
1772
+ ```vue
1773
+ <script setup>
1774
+ const cookies = ref(null);
1775
+ </script>
1776
+
1777
+ <template>
1778
+ <CookieBanner ref="cookies" policy="/privacy" position="end"
1779
+ @change="(choices) => { if (choices.analytics) loadAnalytics(); }" />
1780
+ <footer><button @click="cookies.open({ settings: true })">Cookie settings</button></footer>
1781
+ </template>
1782
+ ```
1783
+
1784
+ - `categories` — `{ id, label, text, required }[]` (default: necessary, analytics, marketing). Optional ones start off.
1785
+ - `storage-key` (default `'gecko:consent'`, `''` = never saved), `version`, `show` (`'auto'` or `false`),
1786
+ `position` (`'bottom' | 'start' | 'end'`), `mount`, `policy`, `words`.
1787
+ - `@change(choices, { action, at })`. Template ref → `{ choices, allowed(id), open({ settings }), close(), reset(), visible, el }`.
1788
+ - It draws nothing where you place it.
1789
+
1790
+ ### LoadingBar / useLoadingBar
1791
+
1792
+ The thin line along the top of the page while something loads. Quick loads never show it.
1793
+
1794
+ ```vue
1795
+ <script setup>
1796
+ import { useLoadingBar } from '@gecko-ui-kit/vue';
1797
+ const saving = ref(false);
1798
+
1799
+ // or by hand
1800
+ const bar = useLoadingBar({ color: 'var(--gk-good)' });
1801
+ async function save() { bar.start(); try { await api.save(booking); bar.done(); } catch { bar.fail(); } }
1802
+ </script>
1803
+
1804
+ <template>
1805
+ <LoadingBar :active="saving" />
1806
+ </template>
1807
+ ```
1808
+
1809
+ - `<LoadingBar :active>` starts when `active` turns true and finishes when it turns false. Template ref → the same handle as below.
1810
+ - `useLoadingBar(options)` (in `setup`) → `{ start(), done(all?), fail(), set(0..1), inc(n), value, loads, active, el }`,
1811
+ the same object for the component's life; removed on unmount. `options` may be an object, a ref or a getter.
1812
+ - Options: `mount` (element, template ref or selector; default the window), `height`, `color`, `trickle`, `delay`, `label`, `words`.
1813
+
1814
+ ### CommandPalette
1815
+
1816
+ The ⌘K search window: type, move with the arrow keys, Enter picks, Esc closes.
1817
+
1818
+ ```vue
1819
+ <script setup>
1820
+ const router = useRouter();
1821
+ const search = (q) => [
1822
+ { label: 'Bikes', items: bikes.value.filter((b) => b.name.toLowerCase().includes(q)).map((b) => ({ title: b.name, sub: b.plate, icon: 'bike', run: () => router.push(`/bikes/${b.id}`) })) },
1823
+ { label: 'Riders', items: riders.value.filter((r) => r.name.toLowerCase().includes(q)).map((r) => ({ title: r.name, sub: r.phone, icon: 'user', run: () => openRider(r) })) },
1824
+ ];
1825
+ </script>
1826
+
1827
+ <template>
1828
+ <CommandPalette v-model:open="searching" placeholder="Search bikes and riders…" :search="search" />
1829
+ </template>
1830
+ ```
1831
+
1832
+ - `search(q)` → groups `{ label, items: [{ title, sub, icon, run }] }`; `q` is trimmed and lowercased. Titles are plain text.
1833
+ - `v-model:open`, `@close`, `@select(item)` (after its `run`), `placeholder`, `empty-title`, `empty-body`.
1834
+
1835
+ ### Tour
1836
+
1837
+ A walk-through: the page dims except a spotlight around each stop, and a bubble explains it. ← → move, Esc ends.
1838
+
1839
+ ```vue
1840
+ <script setup>
1841
+ const touring = ref(false);
1842
+ const searchBtn = ref(null);
1843
+ const steps = [
1844
+ { title: 'Welcome to MotoRent', text: 'A one-minute look around.' },
1845
+ { target: searchBtn, title: 'Find a bike', text: 'Search by name or plate number.' },
1846
+ { target: '#calendar', title: 'Bookings', slot: 'drag' },
1847
+ ];
1848
+ </script>
1849
+
1850
+ <template>
1851
+ <button ref="searchBtn" class="gk-btn">Search</button>
1852
+ <Tour v-model:open="touring" :steps="steps" @end="(finished) => finished && markTourSeen()">
1853
+ <template #drag><p>Drag a booking to <b>move</b> it to another bike.</p></template>
1854
+ </Tour>
1855
+ </template>
1856
+ ```
1857
+
1858
+ - `steps` — `{ target, title, text, slot, placement, padding, radius }`. `target`: a template ref, element, component or
1859
+ selector (missing → skipped; none → bubble in the middle). `slot`: the name of a Tour slot shown instead of `text`
1860
+ (it gets `{ step, index }`).
1861
+ - `v-model:open` (setting it to false ends it quietly, without `@end`), `start`, `@step(index, step)`, `@end(finished)`.
1862
+ - `placement`, `padding`, `radius`, `backdrop`, `scroll`, `words`. Template ref → `{ start(i), next(), prev(), go(i), stop(), index, active }`.
1863
+
1864
+ ### Lightbox
1865
+
1866
+ Full-screen photos that grow out of their thumbnail and shrink back into it. Swipe, zoom, drag down to close.
1867
+
1868
+ ```vue
1869
+ <script setup>
1870
+ const thumbs = ref([]);
1871
+ const shown = ref(false), photo = ref(0);
1872
+ </script>
1873
+
1874
+ <template>
1875
+ <img v-for="(p, i) in bike.photos" :key="p.id" ref="thumbs" :src="p.thumb" :alt="p.alt" @click="photo = i; shown = true" />
1876
+ <Lightbox v-model:open="shown" v-model:index="photo"
1877
+ :items="bike.photos.map((p, i) => ({ src: p.big, alt: p.alt, caption: p.caption, from: thumbs[i] }))" />
1878
+ </template>
1879
+ ```
1880
+
1881
+ - `items` — image addresses or `{ src, alt, caption, w, h, from }` (`from`: the thumbnail element, template ref or selector).
1882
+ - `v-model:open`, `v-model:index` (changing it while open moves there), `@change(index)`, `@close(index)`, `zoom`, `max-zoom`, `words`.
1883
+
1884
+ ### LightboxGallery
1885
+
1886
+ The no-state version: wrap links to big images and clicking one opens its whole group.
1887
+
1888
+ ```vue
1889
+ <LightboxGallery class="photos">
1890
+ <a v-for="p in bike.photos" :key="p.id" :href="p.big" data-lightbox="bike" :data-caption="p.caption">
1891
+ <img :src="p.thumb" :alt="p.alt" />
1892
+ </a>
1893
+ </LightboxGallery>
1894
+ ```
1895
+
1896
+ - Elements with the same `data-lightbox` value form one gallery; image from `href`, `data-src` or the inner `<img>`.
1897
+ - `selector`, `zoom`, `max-zoom`, `words`, `@change(index)`, `@close(index)`, `as` (the wrapper element, default `div`).
1898
+
1899
+ ## App shell
1900
+
1901
+ ### AppShell
1902
+
1903
+ The whole frame around your pages: Sidebar, Topbar, the page in `<main class="gk-view">`, the phone tab bar, the ⌘K
1904
+ palette, keyboard shortcuts and the opening animation. When the path changes, the new page slides in from the
1905
+ direction of travel. It works with Nuxt and vue-router: give it the current path and a way to navigate.
1906
+
1907
+ ```vue
1908
+ <!-- layouts/default.vue (Nuxt) -->
1909
+ <script setup>
1910
+ import { AppShell } from '@gecko-ui-kit/vue';
1911
+ import { NuxtLink } from '#components';
1912
+
1913
+ const route = useRoute();
1914
+ const nav = [
1915
+ { label: 'Shop', items: [
1916
+ { id: 'today', label: 'Today', icon: 'today', href: '/' },
1917
+ { id: 'bikes', label: 'Bikes', icon: 'layers', subs: [['fleet', 'Fleet'], ['repairs', 'Repairs']] }, // /bikes/fleet, /bikes/repairs
1918
+ { id: 'bookings', label: 'Bookings', icon: 'rota', count: () => pending.value.length },
1919
+ ] },
1920
+ { label: 'People', items: [{ id: 'riders', label: 'Riders', icon: 'people' }] },
1921
+ ];
1922
+ const me = { name: 'Pim Wong', role: 'Manager', menu: [{ icon: 'user', label: 'Profile', run: () => navigateTo('/profile') }] };
1923
+ </script>
1924
+
1925
+ <template>
1926
+ <AppShell :brand="{ name: 'MotoRent', sub: 'Chiang Mai' }" :nav="nav" :end="[{ id: 'settings', label: 'Settings', icon: 'settings' }]" :user="me"
1927
+ :path="route.path" @navigate="(href) => navigateTo(href)" :link="NuxtLink" storage-key="motorent"
1928
+ :top="{ search: { placeholder: 'Search bikes…' }, bell: { count: unread, onClick: openInbox }, primary: { label: 'New booking', run: newBooking } }"
1929
+ :search="(q) => [{ label: 'Bikes', items: findBikes(q).map((b) => ({ title: b.name, sub: b.plate, icon: 'layers', run: () => navigateTo(`/bikes/${b.id}`) })) }]">
1930
+ <slot />
1931
+ <template #extra><TimerButton /></template>
1932
+ </AppShell>
1933
+ </template>
1934
+ ```
1935
+
1936
+ - `nav` (groups of `{ id, label, icon, href, count, subs, blurb, tabs }`), `end` (items pinned to the bottom), `brand`, `user`.
1937
+ An item's address is `href`, else `/${id}` (`base` adds a prefix); a sub-page's is `/${id}/${subId}`.
1938
+ - `path` — the current path (`useRoute().path`); `@navigate(href)` — called by every link, menu, the palette and keys
1939
+ (`navigateTo` / `router.push`); `link` — a link component such as `NuxtLink` or `RouterLink` (it gets `to`).
1940
+ - `top` — `{ search: { placeholder, onOpen } | false, theme, bell: { count, onClick }, primary: { label, icon, run } }`. `crumbs-root`.
1941
+ - `tabbar` (ids for the phone tab bar), `tabs`, `intro`, `shortcuts`, `keys: [{ key, label, run(shell) }]`, `search(q)`, `storage-key`, `rail-breakpoint`, `mobile`, `words`.
1942
+ - Slots: default (the page), `#extra` (buttons in the topbar before the theme switch).
1943
+
1944
+ ### useShell
1945
+
1946
+ Inside `<AppShell>` (in any page or component under it), the shell's state and actions; `null` outside.
1947
+
1948
+ ```vue
1949
+ <script setup>
1950
+ import { useShell } from '@gecko-ui-kit/vue';
1951
+ const shell = useShell();
1952
+ </script>
1953
+
1954
+ <template>
1955
+ <p v-if="shell?.route.page === 'bikes'">Section: {{ shell.route.sub }}</p>
1956
+ <Button icon="search" @click="shell?.palette()">Find a bike</Button>
1957
+ </template>
1958
+ ```
1959
+
1960
+ - A reactive object: `route` (`{ page, sub }`) and `path` follow the current path.
1961
+ - `navigate(href)`, `palette()`, `shortcuts()`, `intro()`, `setRail(rail)`, `isRail()`.
1962
+
1963
+ ### shellBootScript
1964
+
1965
+ A small script for the page `<head>` that puts the saved theme and rail on `<html>` before the first paint, so
1966
+ nothing jumps when the app wakes up.
1967
+
1968
+ ```js
1969
+ // app.vue (Nuxt)
1970
+ import { shellBootScript } from '@gecko-ui-kit/vue';
1971
+ useHead({ script: [{ innerHTML: shellBootScript({ storageKey: 'motorent' }), tagPriority: 'critical' }] });
1972
+ ```
1973
+
1974
+ - `storageKey` (same as on AppShell, default `'gecko'`), `railBreakpoint` (default 1280). Returns the script text.
1975
+
1976
+ ### Sidebar
1977
+
1978
+ The main menu: a pill stretches to the current item, the open section unfolds its sub-pages, counts flash when
1979
+ they change, and it collapses to a rail of icons with a flyout on hover. On phones it is a drawer.
1980
+
1981
+ ```vue
1982
+ <Sidebar :brand="{ name: 'Friday', sub: 'Projects', icon: 'logo' }" :nav="nav" :end="end" :user="me"
1983
+ :path="route.path" @navigate="(href) => router.push(href)" storage-key="friday" ref="sidebar" />
1984
+ ```
1985
+
1986
+ - Same `nav`, `end`, `path`, `base`, `home`, `@navigate`, `link`, `words` as AppShell; `brand`, `user`, `storage-key`, `rail-breakpoint`, `mobile`.
1987
+ - Clicking the open item folds its sub-pages instead of navigating. The `[` key and the panel button switch the rail (inside AppShell).
1988
+ - Template ref → `{ setRail(rail), isRail(), el }` (`sidebar.value.setRail(true)`).
1989
+
1990
+ ### Topbar
1991
+
1992
+ The bar above the page: breadcrumbs from the route, a search button, your own buttons, a theme switch that
1993
+ spreads from the button, a bell whose badge pops when the number goes up, and one main action.
1994
+
1995
+ ```vue
1996
+ <Topbar :nav="nav" :path="route.path" @navigate="(href) => router.push(href)" crumbs-root="Friday"
1997
+ :search="{ placeholder: 'Search projects…', onOpen: () => (searching = true) }"
1998
+ :bell="{ count: unread, onClick: (button) => openInbox(button) }"
1999
+ :primary="{ label: 'New project', icon: 'plus', run: () => (creating = true) }">
2000
+ <TimerButton />
2001
+ </Topbar>
2002
+ ```
2003
+
2004
+ - `crumbs-root`, `search` (`false` hides it), `theme` (`false` hides it), `bell: { count, onClick(button) }`, `primary: { label, icon, tip, run(button) }`, `@search`.
2005
+ - Default slot: buttons before the theme switch. The menu button (phones) opens the Sidebar drawer.
2006
+
2007
+ ### PageHeader
2008
+
2009
+ The top of a page: an eyebrow, a big title whose letters roll up (again when it changes), a line of text,
2010
+ buttons on the right, and tabs with an underline that stretches to the chosen tab.
2011
+
2012
+ ```vue
2013
+ <!-- pages/bikes/repairs.vue — inside AppShell the Bikes sub-pages become link tabs by themselves -->
2014
+ <PageHeader eyebrow="Workshop" title="Repairs" sub="Bikes in the workshop this week." :counts="{ repairs: waiting.length }">
2015
+ <template #actions><Button variant="primary" icon="plus">Book a repair</Button></template>
2016
+ </PageHeader>
2017
+
2018
+ <!-- your own tabs (buttons) -->
2019
+ <PageHeader title="Project Apollo" :tabs="[['board', 'Board'], ['list', 'List'], ['files', 'Files', 4]]" v-model="view" />
2020
+ ```
2021
+
2022
+ - `title` (text), `eyebrow`, `sub` (text or `#eyebrow` / `#sub` slots), `#actions` slot.
2023
+ - `tabs` — `[{ id, label, count, href }]` or `[id, label, count?, href?]`; with `href` they are links, without they are buttons
2024
+ (`v-model` = the chosen id, or `default-value`; `@tab-change(id)`). Inside AppShell, leave it out to get the current item's
2025
+ sub-pages; `:tabs="false"` hides them. `counts: { tabId: n }` adds badges.
2026
+ - Letters are split by grapheme, so Thai vowels and tone marks stay on their letter. Template ref → `{ el }` (the `<header>`).
2027
+
2028
+ ### MobileTabbar
2029
+
2030
+ On phones (760px and below) a tab bar at the bottom with your main sections; a soft highlight stretches to the
2031
+ current one and “More” lists the rest. Hidden on wider screens.
2032
+
2033
+ ```vue
2034
+ <MobileTabbar :nav="nav" :end="end" :path="route.path" @navigate="(href) => router.push(href)" :tabbar="['today', 'bikes', 'bookings', 'riders']" />
2035
+ ```
2036
+
2037
+ - `tabbar` — ids that get a tab (default: the first four items). The rest go under “More” (`words.more`).
2038
+
2039
+ ## Helpers
2040
+
2041
+ - `useMotion(fn, options)`: run any `@gecko-ui-kit/motion` helper on an element you render; returns a template ref.
2042
+ `options` may be a value, a ref or a getter (it runs again when they change). Stopped on unmount.
2043
+ - `useModel(props)` + `modelProps()`: the v-model / default-value pattern the components use.
2044
+ - `mounted(name, mountFn, spec)` and `enhancer(name, motionFn, spec)`: turn your own vanilla-style piece into a
2045
+ component the same way this package does (see `src/core.js`).
2046
+ - `<Icon name="bike" />`: any icon from `@gecko-ui-kit/icons`.
2047
+ - `GeckoUI` (plugin) and `components` (every component by name).
2048
+
2049
+ ## Tests
2050
+
2051
+ `npm run check:vue` in the repo type-checks every component, draws each one on the server, hydrates it in a browser on
2052
+ a desktop (light) and a phone (dark, reduced motion), clicks and types through it, unmounts it, mounts it again and
2053
+ unmounts it again, and checks nothing is left behind. It runs on every push.