diff --git a/packages/leptos/textarea/Cargo.toml b/packages/leptos/textarea/Cargo.toml new file mode 100644 index 0000000..e50a7a1 --- /dev/null +++ b/packages/leptos/textarea/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "shadcn-ui-leptos-textarea" +description = "Leptos port of shadcn/ui textarea." +publish = false + +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +version.workspace = true + +[dependencies] +leptos.workspace = true +tailwind_fuse.workspace = true diff --git a/packages/leptos/textarea/README.md b/packages/leptos/textarea/README.md new file mode 100644 index 0000000..a203c64 --- /dev/null +++ b/packages/leptos/textarea/README.md @@ -0,0 +1,13 @@ +

+ + + +

+ +

shadcn-ui-leptos-textarea

+ +Displays a form textarea or a component that looks like a textarea. + +## Rust shadcn/ui + +[Rust shadcn/ui](https://github.com/NixySoftware/shadcn-ui) is a Rust port of [shadcn/ui](https://ui.shadcn.com/). diff --git a/packages/leptos/textarea/src/default.rs b/packages/leptos/textarea/src/default.rs new file mode 100644 index 0000000..9aad80d --- /dev/null +++ b/packages/leptos/textarea/src/default.rs @@ -0,0 +1,20 @@ +use leptos::*; +use tailwind_fuse::*; + +#[derive(TwClass)] +#[tw( + class = "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50" +)] +pub struct TextareaClass {} + +#[component] +pub fn Textarea( + #[prop(into, optional)] class: MaybeSignal, + #[prop(attrs)] attributes: Vec<(&'static str, Attribute)>, +) -> impl IntoView { + let class = create_memo(move |_| TextareaClass {}.with_class(class.get())); + + view! { +