summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/input.tsx
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-12-10 21:16:50 -0600
committerAdam <[email protected]>2025-12-11 06:48:58 -0600
commit3bb546c94d6bb295bfeafdafbb9d34b7cc462560 (patch)
tree54ae4fa1b18c68d23ff460caab596e942593a857 /packages/ui/src/components/input.tsx
parent8e15bcb68e9a8a37bb12afca3984f3967ccb58eb (diff)
downloadopencode-3bb546c94d6bb295bfeafdafbb9d34b7cc462560.tar.gz
opencode-3bb546c94d6bb295bfeafdafbb9d34b7cc462560.zip
wip(desktop): progress
Diffstat (limited to 'packages/ui/src/components/input.tsx')
-rw-r--r--packages/ui/src/components/input.tsx42
1 files changed, 36 insertions, 6 deletions
diff --git a/packages/ui/src/components/input.tsx b/packages/ui/src/components/input.tsx
index 82f704e8c..8e2a115c6 100644
--- a/packages/ui/src/components/input.tsx
+++ b/packages/ui/src/components/input.tsx
@@ -4,31 +4,61 @@ import type { ComponentProps } from "solid-js"
export interface InputProps
extends ComponentProps<typeof Kobalte.Input>,
- Partial<Pick<ComponentProps<typeof Kobalte>, "value" | "onChange" | "onKeyDown">> {
+ Partial<
+ Pick<
+ ComponentProps<typeof Kobalte>,
+ | "name"
+ | "defaultValue"
+ | "value"
+ | "onChange"
+ | "onKeyDown"
+ | "validationState"
+ | "required"
+ | "disabled"
+ | "readOnly"
+ >
+ > {
label?: string
hideLabel?: boolean
hidden?: boolean
description?: string
+ error?: string
+ variant?: "normal" | "ghost"
}
export function Input(props: InputProps) {
const [local, others] = splitProps(props, [
+ "name",
+ "defaultValue",
+ "value",
+ "onChange",
+ "onKeyDown",
+ "validationState",
+ "required",
+ "disabled",
+ "readOnly",
"class",
"label",
"hidden",
"hideLabel",
"description",
- "value",
- "onChange",
- "onKeyDown",
+ "error",
+ "variant",
])
return (
<Kobalte
data-component="input"
- style={{ height: local.hidden ? 0 : undefined }}
+ data-variant={local.variant || "normal"}
+ name={local.name}
+ defaultValue={local.defaultValue}
value={local.value}
onChange={local.onChange}
onKeyDown={local.onKeyDown}
+ required={local.required}
+ disabled={local.disabled}
+ readOnly={local.readOnly}
+ style={{ height: local.hidden ? 0 : undefined }}
+ validationState={local.validationState}
>
<Show when={local.label}>
<Kobalte.Label data-slot="input-label" classList={{ "sr-only": local.hideLabel }}>
@@ -39,7 +69,7 @@ export function Input(props: InputProps) {
<Show when={local.description}>
<Kobalte.Description data-slot="input-description">{local.description}</Kobalte.Description>
</Show>
- <Kobalte.ErrorMessage data-slot="input-error" />
+ <Kobalte.ErrorMessage data-slot="input-error">{local.error}</Kobalte.ErrorMessage>
</Kobalte>
)
}