summaryrefslogtreecommitdiff
path: root/frontend/src/lib/components/ui/textarea
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-18 18:11:53 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-18 18:11:53 +0800
commitadcf80b6e7e2c1a6418f06774178d6fd699bbfce (patch)
tree21ad3b7fcdea1ec0f99292cf68fe93a772870c9c /frontend/src/lib/components/ui/textarea
parent1e1a7eeb58bb23d60b72b0b9ed780d43c2681ac6 (diff)
downloadstrategy-lab-adcf80b6e7e2c1a6418f06774178d6fd699bbfce.tar.gz
[新增功能] shadcn 新增 skeleton / textarea 组件(三态模板与表单组件底座)
Diffstat (limited to 'frontend/src/lib/components/ui/textarea')
-rw-r--r--frontend/src/lib/components/ui/textarea/index.ts7
-rw-r--r--frontend/src/lib/components/ui/textarea/textarea.svelte22
2 files changed, 29 insertions, 0 deletions
diff --git a/frontend/src/lib/components/ui/textarea/index.ts b/frontend/src/lib/components/ui/textarea/index.ts
new file mode 100644
index 0000000..ace797a
--- /dev/null
+++ b/frontend/src/lib/components/ui/textarea/index.ts
@@ -0,0 +1,7 @@
+import Root from "./textarea.svelte";
+
+export {
+ Root,
+ //
+ Root as Textarea,
+};
diff --git a/frontend/src/lib/components/ui/textarea/textarea.svelte b/frontend/src/lib/components/ui/textarea/textarea.svelte
new file mode 100644
index 0000000..76869d0
--- /dev/null
+++ b/frontend/src/lib/components/ui/textarea/textarea.svelte
@@ -0,0 +1,22 @@
+<script lang="ts">
+ import { cn, type WithElementRef, type WithoutChildren } from "$lib/utils.js";
+ import type { HTMLTextareaAttributes } from "svelte/elements";
+
+ let {
+ ref = $bindable(null),
+ value = $bindable(),
+ class: className,
+ "data-slot": dataSlot = "textarea",
+ ...restProps
+ }: WithoutChildren<WithElementRef<HTMLTextareaAttributes>> = $props();
+</script>
+
+<textarea
+ bind:this={ref}
+ data-slot={dataSlot}
+ class={cn(
+ "border-input bg-input/20 dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 resize-none rounded-md border px-2 py-2 text-sm transition-colors focus-visible:ring-2 aria-invalid:ring-2 md:text-xs/relaxed flex field-sizing-content min-h-16 w-full outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
+ className
+ )}
+ bind:value
+ {...restProps}></textarea>