summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/input.tsx
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-10-22 17:31:44 -0500
committerAdam <[email protected]>2025-10-22 17:31:49 -0500
commit89b703c387aed3ee918d826b788b4be1729bdde9 (patch)
tree9a22d26bfc5e921789924e2344d04113660b67a3 /packages/ui/src/components/input.tsx
parenteff12cb48453e45590a53a7705c5044a0da9e7f7 (diff)
downloadopencode-89b703c387aed3ee918d826b788b4be1729bdde9.tar.gz
opencode-89b703c387aed3ee918d826b788b4be1729bdde9.zip
wip: desktop work
Diffstat (limited to 'packages/ui/src/components/input.tsx')
-rw-r--r--packages/ui/src/components/input.tsx27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/ui/src/components/input.tsx b/packages/ui/src/components/input.tsx
new file mode 100644
index 000000000..509e242c9
--- /dev/null
+++ b/packages/ui/src/components/input.tsx
@@ -0,0 +1,27 @@
+import { TextField as Kobalte } from "@kobalte/core/text-field"
+import { Show, splitProps } from "solid-js"
+import type { ComponentProps } from "solid-js"
+
+export interface InputProps extends ComponentProps<typeof Kobalte> {
+ label?: string
+ hideLabel?: boolean
+ description?: string
+}
+
+export function Input(props: InputProps) {
+ const [local, others] = splitProps(props, ["class", "label", "hideLabel", "description", "placeholder"])
+ return (
+ <Kobalte {...others} data-component="input">
+ <Show when={local.label}>
+ <Kobalte.Label data-slot="label" classList={{ "sr-only": local.hideLabel }}>
+ {local.label}
+ </Kobalte.Label>
+ </Show>
+ <Kobalte.Input data-slot="input" class={local.class} placeholder={local.placeholder} />
+ <Show when={local.description}>
+ <Kobalte.Description data-slot="description">{local.description}</Kobalte.Description>
+ </Show>
+ <Kobalte.ErrorMessage data-slot="error" />
+ </Kobalte>
+ )
+}