Skip to content

Commit 5bd9f70

Browse files
committed
chore: combobox documentation
1 parent 68af38e commit 5bd9f70

File tree

8 files changed

+293
-909
lines changed

8 files changed

+293
-909
lines changed

bun.lock

Lines changed: 245 additions & 705 deletions
Large diffs are not rendered by default.

docs/guide/components/combobox.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# Combobox (wip)
2-
31
<Hero
42
title="stacks/combobox"
53
description="An opinionated combobox component for Stacks"
64
link="https://github.com/stacksjs/stacks/tree/main/storage/framework/core/components/combobox"
75
/>
6+
<br>
87

98
# Install
109

@@ -32,4 +31,41 @@ yarn add @stacksjs/combobox
3231

3332
:::
3433

34+
<br>
35+
36+
# Usage
37+
38+
`Comboboxes` are built using the `Combobox`, `ComboboxInput`, `ComboboxOptions`, `ComboboxOption` and `ComboboxLabel` components.
39+
40+
The `ComboboxInput` will automatically open/close the `ComboboxOptions` when searching.
41+
42+
You are completely in charge of how you filter the results, whether it be with a fuzzy search library client-side or by making server-side requests to an API. In this example we will keep the logic simple for demo purposes.
43+
44+
```vue
45+
<script lang="ts" setup>
46+
import { Combobox, ComboboxInput, ComboboxOptions, ComboboxOption } from '@stacksjs/combobox'
47+
</script>
48+
49+
<template>
50+
<Combobox v-model="selectedPerson">
51+
<ComboboxInput @change="query = $event.target.value" />
52+
<ComboboxOptions>
53+
<ComboboxOption
54+
v-for="person in filteredPeople"
55+
:key="person"
56+
:value="person"
57+
>
58+
{{ person }}
59+
</ComboboxOption>
60+
</ComboboxOptions>
61+
</Combobox>
62+
</template>
63+
```
64+
65+
<br>
66+
67+
# Demo
68+
3569
<ComboboxDemo />
70+
71+
Still have questions relating this component's usage? Contact us and we will help you out. In the meantime, if you are curious about the [`<CommandPalette />`](./command-palette.md) component read more on the next page.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"url": "https://github.com/stacksjs/stacks/issues"
1818
},
1919
"scripts": {
20+
"build:reset": "rm -rf node_modules bun.lock && bun install && cd storage/framework && bun run build && cd ../../",
2021
"buddy": "bun ./storage/framework/core/buddy/src/cli.ts",
2122
"stacks": "./buddy",
2223
"setup": "./storage/framework/scripts/setup.sh",

storage/framework/defaults/components/Docs/demo/ComboboxDemo.vue

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import {
99
1010
import { TransitionRoot } from '@stacksjs/transition'
1111
import { computed, ref } from 'vue'
12-
import Hero from './Hero.vue'
13-
import Installation from './Installation.vue'
1412
1513
interface Person {
1614
id: number
@@ -96,20 +94,10 @@ const usageDescription = `Comboboxes are built using the <code><b>Combobox</b></
9694
<template>
9795
<div class="demo-wrapper">
9896
<div class="flex flex-col mx-auto max-w-full">
99-
<header class="flex-center flex-col py-20">
100-
<Hero
101-
title="stacks/combobox"
102-
description="An opinionated combobox component for Stacks"
103-
link="https://github.com/stacksjs/stacks/tree/main/storage/framework/core/components/combobox"
104-
/>
105-
</header>
10697
<main
10798
class="text-primary grid grid-cols-1 gap-8 pb-20 text-xs 2xl:text-sm"
10899
>
109-
<Installation code="bun install @stacksjs/combobox" />
110-
<Usage :code="usageCode" :description="usageDescription" />
111100
<div class="flex flex-col gap-2">
112-
<h2 class="text-2xl font-bold text-gray-900">Demo</h2>
113101
<p class="text-gray-600 text-xl">Search and select a person from the list</p>
114102
</div>
115103
<div class="relative">

storage/framework/defaults/components/Docs/demo/Hero.vue

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script lang="ts" setup>
2-
import { ref } from 'vue'
3-
42
defineProps({
53
title: {
64
type: String,
@@ -15,7 +13,6 @@ defineProps({
1513
required: true,
1614
},
1715
})
18-
1916
</script>
2017

2118
<template>
@@ -25,20 +22,20 @@ defineProps({
2522
<div class="toast" />
2623
<div class="toast" />
2724
</div>
28-
<h1 class=" text-transparent bg-clip-text bg-gradient-to-r from-blue-500 to-blue-700 dark:to-blue-300 mb-3 text-5xl font-bold -mt-5">
25+
<h1 class="text-transparent bg-clip-text bg-gradient-to-r from-blue-500 to-blue-700 dark:to-blue-300 mb-3 text-5xl font-bold -mt-5">
2926
{{ title }}
3027
</h1>
3128
<p class="mb-3 mt-0 text-lg">
3229
{{ description }}
3330
</p>
3431

35-
<a
36-
class="button btn-secondary"
37-
:href="link"
38-
target="_blank"
39-
>
40-
Github
41-
</a>
32+
<a
33+
class="button btn-secondary"
34+
:href="link"
35+
target="_blank"
36+
>
37+
Github
38+
</a>
4239
</div>
4340
</template>
4441

@@ -47,6 +44,7 @@ defineProps({
4744
display: flex;
4845
flex-direction: column;
4946
margin: 0 auto;
47+
width: 400px;
5048
height: 100px;
5149
width: 400px;
5250
position: relative;

storage/framework/defaults/components/Docs/demo/Usage.vue

Lines changed: 0 additions & 52 deletions
This file was deleted.

storage/framework/defaults/components/Docs/demo/composables/useCopyCode.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

storage/framework/defaults/components/Docs/demo/plugins/highlight.ts

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)