mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-20 08:14:57 +01:00
wip: desktop work
This commit is contained in:
27
packages/ui/src/components/input.tsx
Normal file
27
packages/ui/src/components/input.tsx
Normal file
@@ -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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user