@pokle/basecoat 0.3.10-beta2.pokle
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/.eleventy.js +47 -0
- package/.gitattributes +1 -0
- package/.gitignore +12 -0
- package/AGENTS.md +112 -0
- package/CONTRIBUTING.md +15 -0
- package/LICENSE.md +21 -0
- package/README.md +29 -0
- package/ROADMAP.md +20 -0
- package/docs/css/custom.css +92 -0
- package/docs/css/highlight.css +151 -0
- package/docs/css/styles.css +8 -0
- package/docs/css/themes/claude.css +95 -0
- package/docs/css/themes/doom-64.css +95 -0
- package/docs/css/themes/supabase.css +100 -0
- package/docs/src/_data/site.js +10 -0
- package/docs/src/_includes/layouts/base.njk +112 -0
- package/docs/src/_includes/layouts/layout.njk +15 -0
- package/docs/src/_includes/layouts/page.njk +21 -0
- package/docs/src/_includes/macros/code_block.njk +23 -0
- package/docs/src/_includes/macros/code_preview.njk +26 -0
- package/docs/src/_includes/macros/toc.njk +20 -0
- package/docs/src/_includes/partials/header.njk +64 -0
- package/docs/src/_includes/partials/kitchen-sink/accordion.njk +89 -0
- package/docs/src/_includes/partials/kitchen-sink/alert-dialog.njk +26 -0
- package/docs/src/_includes/partials/kitchen-sink/alert.njk +72 -0
- package/docs/src/_includes/partials/kitchen-sink/avatar.njk +37 -0
- package/docs/src/_includes/partials/kitchen-sink/badge.njk +47 -0
- package/docs/src/_includes/partials/kitchen-sink/breadcrumb.njk +42 -0
- package/docs/src/_includes/partials/kitchen-sink/button.njk +101 -0
- package/docs/src/_includes/partials/kitchen-sink/card.njk +147 -0
- package/docs/src/_includes/partials/kitchen-sink/checkbox.njk +34 -0
- package/docs/src/_includes/partials/kitchen-sink/combobox.njk +83 -0
- package/docs/src/_includes/partials/kitchen-sink/dialog.njk +65 -0
- package/docs/src/_includes/partials/kitchen-sink/dropdown-menu.njk +294 -0
- package/docs/src/_includes/partials/kitchen-sink/form.njk +106 -0
- package/docs/src/_includes/partials/kitchen-sink/input.njk +27 -0
- package/docs/src/_includes/partials/kitchen-sink/label.njk +30 -0
- package/docs/src/_includes/partials/kitchen-sink/pagination.njk +34 -0
- package/docs/src/_includes/partials/kitchen-sink/popover.njk +43 -0
- package/docs/src/_includes/partials/kitchen-sink/radio-group.njk +33 -0
- package/docs/src/_includes/partials/kitchen-sink/select.njk +99 -0
- package/docs/src/_includes/partials/kitchen-sink/skeleton.njk +40 -0
- package/docs/src/_includes/partials/kitchen-sink/slider.njk +38 -0
- package/docs/src/_includes/partials/kitchen-sink/switch.njk +27 -0
- package/docs/src/_includes/partials/kitchen-sink/table.njk +74 -0
- package/docs/src/_includes/partials/kitchen-sink/tabs.njk +105 -0
- package/docs/src/_includes/partials/kitchen-sink/textarea.njk +27 -0
- package/docs/src/_includes/partials/kitchen-sink/toast.njk +25 -0
- package/docs/src/_includes/partials/kitchen-sink/tooltip.njk +24 -0
- package/docs/src/_includes/partials/sidebar.njk +139 -0
- package/docs/src/assets/apple-touch-icon.png +0 -0
- package/docs/src/assets/favicon.svg +12 -0
- package/docs/src/assets/images/avatar-1.png +0 -0
- package/docs/src/assets/images/avatar-2.png +0 -0
- package/docs/src/assets/images/avatar-3.png +0 -0
- package/docs/src/assets/images/screenshot.png +0 -0
- package/docs/src/assets/social-screenshot.png +0 -0
- package/docs/src/assets/social.png +0 -0
- package/docs/src/assets/styles.css +6309 -0
- package/docs/src/components/accordion.njk +75 -0
- package/docs/src/components/alert-dialog.njk +119 -0
- package/docs/src/components/alert.njk +108 -0
- package/docs/src/components/avatar.njk +40 -0
- package/docs/src/components/badge.njk +93 -0
- package/docs/src/components/breadcrumb.njk +71 -0
- package/docs/src/components/button-group.njk +290 -0
- package/docs/src/components/button.njk +141 -0
- package/docs/src/components/card.njk +156 -0
- package/docs/src/components/carousel.njk +102 -0
- package/docs/src/components/chart.njk +814 -0
- package/docs/src/components/checkbox.njk +101 -0
- package/docs/src/components/combobox.njk +293 -0
- package/docs/src/components/command.njk +288 -0
- package/docs/src/components/dialog.njk +177 -0
- package/docs/src/components/dropdown-menu.njk +403 -0
- package/docs/src/components/empty.njk +157 -0
- package/docs/src/components/field.njk +459 -0
- package/docs/src/components/form.njk +79 -0
- package/docs/src/components/input-group.njk +372 -0
- package/docs/src/components/input.njk +90 -0
- package/docs/src/components/item.njk +320 -0
- package/docs/src/components/kbd.njk +76 -0
- package/docs/src/components/label.njk +41 -0
- package/docs/src/components/pagination.njk +48 -0
- package/docs/src/components/popover.njk +174 -0
- package/docs/src/components/progress.njk +44 -0
- package/docs/src/components/radio-group.njk +48 -0
- package/docs/src/components/select.njk +457 -0
- package/docs/src/components/sidebar.njk +219 -0
- package/docs/src/components/skeleton.njk +51 -0
- package/docs/src/components/slider.njk +47 -0
- package/docs/src/components/spinner.njk +214 -0
- package/docs/src/components/switch.njk +54 -0
- package/docs/src/components/table.njk +87 -0
- package/docs/src/components/tabs.njk +232 -0
- package/docs/src/components/textarea.njk +90 -0
- package/docs/src/components/theme-switcher.njk +111 -0
- package/docs/src/components/toast.njk +279 -0
- package/docs/src/components/tooltip.njk +53 -0
- package/docs/src/fragments/toast/error.njk +6 -0
- package/docs/src/fragments/toast/info.njk +5 -0
- package/docs/src/fragments/toast/success.njk +7 -0
- package/docs/src/fragments/toast/warning.njk +5 -0
- package/docs/src/index.njk +336 -0
- package/docs/src/installation.njk +275 -0
- package/docs/src/introduction.njk +63 -0
- package/docs/src/kitchen-sink.njk +52 -0
- package/docs/src/llms.txt +506 -0
- package/docs/src/robots.njk +7 -0
- package/docs/src/sitemap.njk +15 -0
- package/docs/src/test.njk +39 -0
- package/package.json +51 -0
- package/packages/cli/README.md +55 -0
- package/packages/cli/index.js +193 -0
- package/packages/cli/package.json +44 -0
- package/packages/css/README.md +63 -0
- package/packages/css/package.json +63 -0
- package/scripts/build.js +170 -0
- package/src/css/basecoat.cdn.css +2 -0
- package/src/css/basecoat.css +1310 -0
- package/src/jinja/command.html.jinja +206 -0
- package/src/jinja/dialog.html.jinja +94 -0
- package/src/jinja/dropdown-menu.html.jinja +124 -0
- package/src/jinja/popover.html.jinja +48 -0
- package/src/jinja/select.html.jinja +196 -0
- package/src/jinja/sidebar.html.jinja +144 -0
- package/src/jinja/tabs.html.jinja +78 -0
- package/src/jinja/toast.html.jinja +117 -0
- package/src/js/basecoat.js +99 -0
- package/src/js/command.js +175 -0
- package/src/js/dropdown-menu.js +171 -0
- package/src/js/popover.js +73 -0
- package/src/js/select.js +432 -0
- package/src/js/sidebar.js +104 -0
- package/src/js/tabs.js +63 -0
- package/src/js/toast.js +181 -0
- package/src/nunjucks/command.njk +206 -0
- package/src/nunjucks/dialog.njk +92 -0
- package/src/nunjucks/dropdown-menu.njk +124 -0
- package/src/nunjucks/popover.njk +48 -0
- package/src/nunjucks/select.njk +196 -0
- package/src/nunjucks/sidebar.njk +144 -0
- package/src/nunjucks/tabs.njk +78 -0
- package/src/nunjucks/toast.njk +117 -0
- package/wrangler.jsonc +7 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: layouts/page.njk
|
|
3
|
+
title: Input Group
|
|
4
|
+
description: Display additional information or actions to an input or textarea.
|
|
5
|
+
toc:
|
|
6
|
+
- label: Usage
|
|
7
|
+
id: usage
|
|
8
|
+
- label: Examples
|
|
9
|
+
id: examples
|
|
10
|
+
children:
|
|
11
|
+
- label: Icon
|
|
12
|
+
id: example-icon
|
|
13
|
+
- label: Text
|
|
14
|
+
id: example-text
|
|
15
|
+
- label: Button
|
|
16
|
+
id: example-button
|
|
17
|
+
- label: Tooltip
|
|
18
|
+
id: example-tooltip
|
|
19
|
+
- label: Textarea
|
|
20
|
+
id: example-textarea
|
|
21
|
+
- label: Spinner
|
|
22
|
+
id: example-spinner
|
|
23
|
+
- label: Dropdown
|
|
24
|
+
id: example-dropdown
|
|
25
|
+
- label: Group
|
|
26
|
+
id: example-group
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
{% from "macros/code_preview.njk" import code_preview %}
|
|
30
|
+
{% from "macros/code_block.njk" import code_block %}
|
|
31
|
+
{% from "dropdown-menu.njk" import dropdown_menu %}
|
|
32
|
+
{% from "popover.njk" import popover %}
|
|
33
|
+
|
|
34
|
+
<div class="alert mb-6">
|
|
35
|
+
{% lucide "circle-alert" %}
|
|
36
|
+
<h2>There is no dedicated Input Group component in Basecoat.</h2>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
{% set code_default %}
|
|
40
|
+
<div class="grid gap-6">
|
|
41
|
+
<div class="relative">
|
|
42
|
+
<input type="text" class="input pl-9 pr-20" placeholder="Search...">
|
|
43
|
+
<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground [&>svg]:size-4">
|
|
44
|
+
{% lucide "search" %}
|
|
45
|
+
</div>
|
|
46
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground text-sm">12 results</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="relative">
|
|
50
|
+
<input type="text" class="input pl-15 pr-9" placeholder="example.com">
|
|
51
|
+
<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground text-sm">https://</div>
|
|
52
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground [&>svg]:size-4" data-tooltip="This is content in a tooltip.">{% lucide "info" %}</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div class="relative">
|
|
56
|
+
<textarea class="textarea pr-10 min-h-27 pb-12" placeholder="Ask, Search or Chat..."></textarea>
|
|
57
|
+
<footer role="group" class="absolute bottom-0 px-3 pb-3 pt-1.5 flex items-center w-full gap-2">
|
|
58
|
+
<button type="button" class="btn-icon-outline rounded-full size-6 text-muted-foreground hover:text-accent-foreground">
|
|
59
|
+
{% lucide "plus" %}
|
|
60
|
+
</button>
|
|
61
|
+
{{ dropdown_menu(
|
|
62
|
+
id="demo-dropdown-menu",
|
|
63
|
+
trigger="Auto",
|
|
64
|
+
trigger_attrs={"class": "btn-sm-ghost text-muted-foreground hover:text-accent-foreground h-6 p-2"},
|
|
65
|
+
popover_attrs={"data-side": "top", "class": "min-w-32"},
|
|
66
|
+
items=[
|
|
67
|
+
{ type: "item", label: "Auto" },
|
|
68
|
+
{ type: "item", label: "Agent" },
|
|
69
|
+
{ type: "item", label: "Manual" }
|
|
70
|
+
]
|
|
71
|
+
) }}
|
|
72
|
+
<div class="text-muted-foreground text-sm ml-auto">52% used</div>
|
|
73
|
+
<hr class="w-0 h-4 border-r border-border shrink-0 m-0">
|
|
74
|
+
<button type="button" class="btn-icon rounded-full size-6 bg-muted-foreground hover:bg-foreground" disabled>
|
|
75
|
+
{% lucide "arrow-up" %}
|
|
76
|
+
</button>
|
|
77
|
+
</footer>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<div class="relative">
|
|
81
|
+
<input type="text" class="input pr-9" placeholder="@shadcn">
|
|
82
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none bg-primary text-primary-foreground flex size-4 items-center justify-center rounded-full [&>svg]:size-3">{% lucide "check" %}</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
{% endset %}
|
|
86
|
+
|
|
87
|
+
{{ code_preview("input-group-default", code_default, class="w-full max-w-sm") }}
|
|
88
|
+
|
|
89
|
+
<h2 id="usage"><a href="#usage">Usage</a></h2>
|
|
90
|
+
|
|
91
|
+
<section class="prose">
|
|
92
|
+
<p>Input groups are pure HTML composition using Tailwind utility classes. There is no dedicated component: use <code>relative</code> positioning on a wrapper, add your content with <code>absolute</code> positioning, and adjust input padding to make room.</p>
|
|
93
|
+
<p>Browse the examples below and copy the pattern that fits your needs.</p>
|
|
94
|
+
</section>
|
|
95
|
+
|
|
96
|
+
<h2 id="examples"><a href="#examples">Examples</a></h2>
|
|
97
|
+
|
|
98
|
+
<h3 id="example-icon"><a href="#example-icon">Icon</a></h3>
|
|
99
|
+
|
|
100
|
+
{% set code_icon %}
|
|
101
|
+
<div class="grid gap-6">
|
|
102
|
+
<div class="relative">
|
|
103
|
+
<input type="text" class="input pl-9" placeholder="Search...">
|
|
104
|
+
<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground [&>svg]:size-4">
|
|
105
|
+
{% lucide "search" %}
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<div class="relative">
|
|
110
|
+
<input type="email" class="input pl-9" placeholder="Enter your email">
|
|
111
|
+
<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground [&>svg]:size-4">
|
|
112
|
+
{% lucide "mail" %}
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<div class="relative">
|
|
117
|
+
<input type="text" class="input px-9" placeholder="Card number">
|
|
118
|
+
<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground [&>svg]:size-4">
|
|
119
|
+
{% lucide "credit-card" %}
|
|
120
|
+
</div>
|
|
121
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground [&>svg]:size-4">
|
|
122
|
+
{% lucide "check" %}
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<div class="relative">
|
|
127
|
+
<input type="text" class="input pr-16" placeholder="Card number">
|
|
128
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground [&>svg]:size-4 flex items-center gap-2">
|
|
129
|
+
{% lucide "star" %}
|
|
130
|
+
{% lucide "info" %}
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
{% endset %}
|
|
135
|
+
|
|
136
|
+
{{ code_preview("input-group-icon-prefix", code_icon, class="w-full max-w-sm") }}
|
|
137
|
+
|
|
138
|
+
<h3 id="example-text"><a href="#example-text">Text</a></h3>
|
|
139
|
+
|
|
140
|
+
{% set code_text %}
|
|
141
|
+
<div class="grid gap-6">
|
|
142
|
+
<div class="relative">
|
|
143
|
+
<input type="text" class="input pl-7 pr-12" placeholder="0.00">
|
|
144
|
+
<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground text-sm">$</div>
|
|
145
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground text-sm">USD</div>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
<div class="relative">
|
|
149
|
+
<input type="text" class="input pl-15 pr-12" placeholder="example.com">
|
|
150
|
+
<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground text-sm">https://</div>
|
|
151
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground text-sm">.com</div>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<div class="relative">
|
|
155
|
+
<input type="text" class="input pr-30" placeholder="Enter your username">
|
|
156
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground text-sm">@company.com</div>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<div class="relative">
|
|
160
|
+
<textarea class="textarea pr-10 min-h-25 pb-12" placeholder="Enter your message"></textarea>
|
|
161
|
+
<footer role="group" class="absolute bottom-0 px-3 pb-3 pt-1.5 flex items-center w-full gap-2">
|
|
162
|
+
<div class="text-muted-foreground text-sm">120 characters left</div>
|
|
163
|
+
</footer>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
{% endset %}
|
|
167
|
+
|
|
168
|
+
{{ code_preview("input-group-text", code_text, class="w-full max-w-sm") }}
|
|
169
|
+
|
|
170
|
+
<h3 id="example-button"><a href="#example-button">Button</a></h3>
|
|
171
|
+
|
|
172
|
+
{% set code_button %}
|
|
173
|
+
<div class="grid gap-6">
|
|
174
|
+
<div class="relative">
|
|
175
|
+
<input type="text" readonly class="input pr-9" value="https://x.com/hunvreus">
|
|
176
|
+
<button
|
|
177
|
+
data-copied="false"
|
|
178
|
+
onclick="
|
|
179
|
+
this.dataset.copied = 'true';
|
|
180
|
+
setTimeout(() => this.dataset.copied = 'false', 2000);
|
|
181
|
+
"
|
|
182
|
+
class="group absolute right-1.5 top-1/2 -translate-y-1/2 btn-icon-ghost text-muted-foreground hover:text-accent-foreground size-6"
|
|
183
|
+
>
|
|
184
|
+
{% lucide "copy", { "class": "group-data-[copied=true]:hidden" } %}
|
|
185
|
+
{% lucide "check", { "class": "hidden group-data-[copied=true]:block" } %}
|
|
186
|
+
</button>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
<div class="relative">
|
|
191
|
+
<input type="text" class="input pl-21 pr-9 rounded-full">
|
|
192
|
+
<button
|
|
193
|
+
aria-pressed="false"
|
|
194
|
+
onclick="this.ariaPressed = this.ariaPressed === 'true' ? 'false' : 'true'"
|
|
195
|
+
class="absolute right-1.5 top-1/2 -translate-y-1/2 btn-icon-ghost text-muted-foreground hover:text-accent-foreground size-6 rounded-full aria-pressed:bg-transparent aria-pressed:hover:bg-accent dark:aria-pressed:hover:bg-accent/50 aria-pressed:text-blue-600 aria-pressed:[&>svg]:fill-blue-600"
|
|
196
|
+
>{% lucide "star" %}</button>
|
|
197
|
+
<div class="absolute left-1.5 top-1/2 -translate-y-1/2 flex items-center gap-1 z-10">
|
|
198
|
+
{% set trigger %}
|
|
199
|
+
{% lucide "info" %}
|
|
200
|
+
{% endset %}
|
|
201
|
+
{% call popover(
|
|
202
|
+
trigger=trigger,
|
|
203
|
+
trigger_attrs={"class": "btn-sm-icon-ghost rounded-full size-6"},
|
|
204
|
+
popover_attrs={"class": "max-w-72"}
|
|
205
|
+
) %}
|
|
206
|
+
<h3 class="font-medium mb-1">Your connection is not secure.</h3>
|
|
207
|
+
<p>You should not enter any sensitive information on this site.</p>
|
|
208
|
+
{% endcall %}
|
|
209
|
+
<div class="text-muted-foreground text-sm pointer-events-none">https://</div>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
<div class="relative">
|
|
214
|
+
<input type="text" readonly class="input pr-9" placeholder="Type to search...">
|
|
215
|
+
<button type="button" class="absolute right-1.5 top-1/2 -translate-y-1/2 btn-secondary h-6 p-2 rounded">Search</button>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
{% endset %}
|
|
219
|
+
|
|
220
|
+
{{ code_preview("input-group-button", code_button, class="w-full max-w-sm") }}
|
|
221
|
+
|
|
222
|
+
<h3 id="example-tooltip"><a href="#example-tooltip">Tooltip</a></h3>
|
|
223
|
+
|
|
224
|
+
{% set code_tooltip %}
|
|
225
|
+
<div class="grid gap-6">
|
|
226
|
+
<div class="relative">
|
|
227
|
+
<input type="password" class="input pr-9" placeholder="Enter password">
|
|
228
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground [&>svg]:size-4" data-tooltip="Password must be at least 8 characters long.">{% lucide "info" %}</div>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<div class="relative">
|
|
232
|
+
<input type="email" class="input pr-9" placeholder="Your email address">
|
|
233
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground [&>svg]:size-4" data-tooltip="We'll use this to send your notifications.">{% lucide "circle-help" %}</div>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
<div class="relative">
|
|
237
|
+
<input type="email" class="input pl-9" placeholder="Your email address">
|
|
238
|
+
<div class="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground [&>svg]:size-4" data-tooltip="Click for help with API keys." data-side="left">{% lucide "circle-help" %}</div>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
{% endset %}
|
|
242
|
+
|
|
243
|
+
{{ code_preview("input-group-tooltip", code_tooltip, class="w-full max-w-sm") }}
|
|
244
|
+
|
|
245
|
+
<h3 id="example-textarea"><a href="#example-textarea">Textarea</a></h3>
|
|
246
|
+
|
|
247
|
+
{% set code_textarea %}
|
|
248
|
+
<div class="relative">
|
|
249
|
+
<textarea class="textarea pt-15 pb-17 min-h-77" placeholder="console.log('Hello, world!')."></textarea>
|
|
250
|
+
<header class="absolute top-0 flex items-center w-full gap-2 p-3 border-b">
|
|
251
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-brand-javascript size-4 text-muted-foreground"><path d="M20 4l-2 14.5l-6 2l-6 -2l-2 -14.5z"></path><path d="M7.5 8h3v8l-2 -1"></path><path d="M16.5 8h-2.5a.5 .5 0 0 0 -.5 .5v3a.5 .5 0 0 0 .5 .5h1.423a.5 .5 0 0 1 .495 .57l-.418 2.93l-2 .5"></path></svg>
|
|
252
|
+
<span class="font-mono text-sm text-muted-foreground mr-auto">script.js</span>
|
|
253
|
+
<button class="btn-sm-icon-ghost text-muted-foreground hover:text-accent-foreground size-6">
|
|
254
|
+
{% lucide "refresh-ccw" %}
|
|
255
|
+
</button>
|
|
256
|
+
<button class="btn-sm-icon-ghost text-muted-foreground hover:text-accent-foreground size-6">
|
|
257
|
+
{% lucide "copy" %}
|
|
258
|
+
</button>
|
|
259
|
+
</header>
|
|
260
|
+
<footer class="absolute bottom-0 flex items-center w-full gap-2 p-3 border-t">
|
|
261
|
+
<span class="text-sm text-muted-foreground mr-auto">Line 1, Column 1</span>
|
|
262
|
+
<button type="button" class="btn-sm">
|
|
263
|
+
Run
|
|
264
|
+
{% lucide "corner-down-left" %}
|
|
265
|
+
</button>
|
|
266
|
+
</footer>
|
|
267
|
+
</div>
|
|
268
|
+
{% endset %}
|
|
269
|
+
|
|
270
|
+
{{ code_preview("input-group-textarea", code_textarea, class="w-full max-w-md") }}
|
|
271
|
+
|
|
272
|
+
<h3 id="example-spinner"><a href="#example-spinner">Spinner</a></h3>
|
|
273
|
+
|
|
274
|
+
{% set code_spinner %}
|
|
275
|
+
<div class="grid gap-6">
|
|
276
|
+
<div class="relative">
|
|
277
|
+
<input type="text" class="input pr-9" placeholder="Searching..." disabled>
|
|
278
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground [&>svg]:size-4 opacity-50">
|
|
279
|
+
{% lucide "loader-circle", { "class": "animate-spin" } %}
|
|
280
|
+
</div>
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<div class="relative">
|
|
284
|
+
<input type="text" class="input pl-9" placeholder="Processing..." disabled>
|
|
285
|
+
<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground [&>svg]:size-4 opacity-50">
|
|
286
|
+
{% lucide "loader-circle", { "class": "animate-spin" } %}
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
|
|
290
|
+
<div class="relative">
|
|
291
|
+
<input type="text" class="input pr-24" placeholder="Saving changes..." disabled>
|
|
292
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2 text-sm text-muted-foreground opacity-50">
|
|
293
|
+
<div>Saving...</div>
|
|
294
|
+
<div class="[&>svg]:size-4">
|
|
295
|
+
{% lucide "loader-circle", { "class": "animate-spin" } %}
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
<div class="relative">
|
|
301
|
+
<input type="text" class="input pl-9 pr-26" placeholder="Refreshing data..." disabled>
|
|
302
|
+
<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground [&>svg]:size-4 opacity-50">
|
|
303
|
+
{% lucide "loader", { "class": "animate-spin" } %}
|
|
304
|
+
</div>
|
|
305
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2 text-sm text-muted-foreground opacity-50">
|
|
306
|
+
Please wait...
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
{% endset %}
|
|
311
|
+
|
|
312
|
+
{{ code_preview("input-group-spinner", code_spinner, class="w-full max-w-md") }}
|
|
313
|
+
|
|
314
|
+
<h3 id="example-dropdown"><a href="#example-dropdown">Dropdown</a></h3>
|
|
315
|
+
|
|
316
|
+
{% set code_dropdown %}
|
|
317
|
+
<div class="grid gap-6">
|
|
318
|
+
<div class="relative">
|
|
319
|
+
<input type="text" class="input pr-9" placeholder="Enter file name">
|
|
320
|
+
{% set trigger %}
|
|
321
|
+
{% lucide "ellipsis" %}
|
|
322
|
+
{% endset %}
|
|
323
|
+
{{ dropdown_menu(
|
|
324
|
+
main_attrs={"class": "absolute right-1.5 top-1/2 -translate-y-1/2 z-10"},
|
|
325
|
+
trigger=trigger,
|
|
326
|
+
trigger_attrs={"class": "btn-sm-icon-ghost text-muted-foreground hover:text-accent-foreground size-6"},
|
|
327
|
+
popover_attrs={"data-align": "end", "class": "min-w-32"},
|
|
328
|
+
items=[
|
|
329
|
+
{ type: "item", label: "Settings" },
|
|
330
|
+
{ type: "item", label: "Copy path" },
|
|
331
|
+
{ type: "item", label: "Open location" }
|
|
332
|
+
]
|
|
333
|
+
) }}
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
<div class="relative">
|
|
337
|
+
<input type="text" class="input pr-30" placeholder="Enter search query">
|
|
338
|
+
{% set trigger %}
|
|
339
|
+
Search in...
|
|
340
|
+
{% lucide "chevron-down", { "class": "size-3" } %}
|
|
341
|
+
{% endset %}
|
|
342
|
+
{{ dropdown_menu(
|
|
343
|
+
main_attrs={"class": "absolute right-1.5 top-1/2 -translate-y-1/2"},
|
|
344
|
+
trigger=trigger,
|
|
345
|
+
trigger_attrs={"class": "btn-sm-ghost text-muted-foreground hover:text-accent-foreground p-2 h-6"},
|
|
346
|
+
popover_attrs={"data-align": "end", "class": "min-w-32"},
|
|
347
|
+
items=[
|
|
348
|
+
{ type: "item", label: "Documentation" },
|
|
349
|
+
{ type: "item", label: "Blog Posts" },
|
|
350
|
+
{ type: "item", label: "Changelog" }
|
|
351
|
+
]
|
|
352
|
+
) }}
|
|
353
|
+
</div>
|
|
354
|
+
</div>
|
|
355
|
+
{% endset %}
|
|
356
|
+
|
|
357
|
+
{{ code_preview("input-group-dropdown", code_dropdown, class="w-full max-w-sm") }}
|
|
358
|
+
|
|
359
|
+
<h3 id="example-group"><a href="#example-group">Group</a></h3>
|
|
360
|
+
|
|
361
|
+
{% set code_group %}
|
|
362
|
+
<div class="flex w-fit items-stretch">
|
|
363
|
+
<label for="url" class="text-sm flex items-center bg-muted border border-r-0 px-4 rounded-l-md shadow-xs">https://</label>
|
|
364
|
+
<div class="relative">
|
|
365
|
+
<input type="text" class="input pr-9 rounded-none">
|
|
366
|
+
<div class="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground [&>svg]:size-4">{% lucide "link-2" %}</div>
|
|
367
|
+
</div>
|
|
368
|
+
<div class="text-sm flex items-center bg-muted border border-l-0 px-4 rounded-r-md shadow-xs">.com</div>
|
|
369
|
+
</div>
|
|
370
|
+
{% endset %}
|
|
371
|
+
|
|
372
|
+
{{ code_preview("input-group-group", code_group, class="w-full max-w-sm") }}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: layouts/page.njk
|
|
3
|
+
title: Input
|
|
4
|
+
description: Displays a form input field or a component that looks like an input field.
|
|
5
|
+
toc:
|
|
6
|
+
- label: Usage
|
|
7
|
+
id: usage
|
|
8
|
+
- label: Examples
|
|
9
|
+
id: examples
|
|
10
|
+
children:
|
|
11
|
+
- label: Default
|
|
12
|
+
id: example-default
|
|
13
|
+
- label: Invalid
|
|
14
|
+
id: example-invalid
|
|
15
|
+
- label: Disabled
|
|
16
|
+
id: example-disabled
|
|
17
|
+
- label: With label
|
|
18
|
+
id: example-with-label
|
|
19
|
+
- label: With text
|
|
20
|
+
id: example-with-text
|
|
21
|
+
- label: With button
|
|
22
|
+
id: example-with-button
|
|
23
|
+
- label: Form
|
|
24
|
+
id: example-form
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
{% from "macros/code_preview.njk" import code_preview %}
|
|
28
|
+
{% from "macros/code_block.njk" import code_block %}
|
|
29
|
+
|
|
30
|
+
{% set code %}<input class="input" type="email" placeholder="Email">{% endset %}
|
|
31
|
+
{{ code_preview("input", code) }}
|
|
32
|
+
|
|
33
|
+
<h2 id="usage">Usage</h2>
|
|
34
|
+
|
|
35
|
+
<section class="prose">
|
|
36
|
+
<p>Simply add the <code>input</code> class to your <code><input></code> element or have a parent with the <code>form</code> class (<a href="/components/form">read more about form</a>). You can also set the <code>aria-invalid</code> attribute to <code>true</code> to make the input invalid.</p>
|
|
37
|
+
</section>
|
|
38
|
+
|
|
39
|
+
{{ code_block(code) }}
|
|
40
|
+
|
|
41
|
+
<h2 id="examples"><a href="#examples">Examples</a></h2>
|
|
42
|
+
|
|
43
|
+
{{ code_preview("input-default", code) }}
|
|
44
|
+
|
|
45
|
+
<h3 id="example-invalid"><a href="#example-invalid">Invalid</a></h3>
|
|
46
|
+
|
|
47
|
+
{% set code %}<input class="input" type="email" placeholder="Email" aria-invalid="true">{% endset %}
|
|
48
|
+
{{ code_preview("input-invalid", code) }}
|
|
49
|
+
|
|
50
|
+
<h3 id="example-disabled"><a href="#example-disabled">Disabled</a></h3>
|
|
51
|
+
|
|
52
|
+
{% set code %}<input class="input" type="email" placeholder="Email" disabled>{% endset %}
|
|
53
|
+
{{ code_preview("input-disabled", code) }}
|
|
54
|
+
|
|
55
|
+
<h3 id="example-with-label"><a href="#example-with-label">With label</a></h3>
|
|
56
|
+
|
|
57
|
+
{% set code %}<div class="grid gap-3">
|
|
58
|
+
<label for="input-with-label" class="label">Label</label>
|
|
59
|
+
<input class="input" id="input-with-label" type="email" placeholder="Email">
|
|
60
|
+
</div>{% endset %}
|
|
61
|
+
{{ code_preview("input-with-label", code) }}
|
|
62
|
+
|
|
63
|
+
<h3 id="example-with-text"><a href="#example-with-text">With text</a></h3>
|
|
64
|
+
|
|
65
|
+
{% set code %}<div class="grid gap-3">
|
|
66
|
+
<label for="input-with-text" class="label">Label</label>
|
|
67
|
+
<input class="input" id="input-with-text" type="email" placeholder="Email">
|
|
68
|
+
<p class="text-muted-foreground text-sm">Fill in your email address.</p>
|
|
69
|
+
</div>{% endset %}
|
|
70
|
+
{{ code_preview("input-with-text", code) }}
|
|
71
|
+
|
|
72
|
+
<h3 id="example-with-button"><a href="#example-with-button">With button</a></h3>
|
|
73
|
+
|
|
74
|
+
{% set code %}<div class="flex items-center space-x-2">
|
|
75
|
+
<input class="input" type="email" placeholder="Email">
|
|
76
|
+
<button type="submit" class="btn">Submit</button>
|
|
77
|
+
</div>{% endset %}
|
|
78
|
+
{{ code_preview("textarea-form", code) }}
|
|
79
|
+
|
|
80
|
+
<h3 id="example-form"><a href="#example-form">Form</a></h3>
|
|
81
|
+
|
|
82
|
+
{% set code %}<form class="form space-y-6 w-full">
|
|
83
|
+
<div class="grid gap-3">
|
|
84
|
+
<label for="input-form" class="label">Username</label>
|
|
85
|
+
<input class="input" id="input-form" type="text" placeholder="hunvreus">
|
|
86
|
+
<p class="text-muted-foreground text-sm">This is your public display name.</p>
|
|
87
|
+
</div>
|
|
88
|
+
<button type="submit" class="btn">Submit</button>
|
|
89
|
+
</form>{% endset %}
|
|
90
|
+
{{ code_preview("input-form", code, "w-full max-w-sm") }}
|