Textarea
Displays a form textarea field or a component that looks like a textarea.
import { component$ } from '@builder.io/qwik';
import { Textarea } from '~/components/ui';
export default component$(() => {
return <Textarea placeholder="Type your message here." />;
});
Installation
Run the following cli command or copy/paste the component code into your project
Usage
Examples
Disabled
import { component$ } from '@builder.io/qwik';
import { Textarea } from '@qwik-ui/styled';
export default component$(() => {
return <Textarea placeholder="Type your message here." disabled />;
});
With Label
import { component$ } from '@builder.io/qwik';
import { Label, Textarea } from '~/components/ui';
export default component$(() => {
return (
<div class="grid w-full gap-1.5">
<Label for="message">Your message</Label>
<Textarea placeholder="Type your message here." id="message" />
</div>
);
});
With button
import { component$ } from '@builder.io/qwik';
import { Button, Textarea } from '~/components/ui';
export default component$(() => {
return (
<div class="grid w-full gap-2">
<Textarea placeholder="Type your message here." />
<Button class="ml-auto w-40">Send message</Button>
</div>
);
});
With text
Your message will be copied to the support team.
import { component$ } from '@builder.io/qwik';
import { Label, Textarea } from '~/components/ui';
export default component$(() => {
return (
<div class="grid w-full gap-1.5">
<Label for="message-2">Your Message</Label>
<Textarea placeholder="Type your message here." id="message-2" />
<p class="text-sm text-muted-foreground">
Your message will be copied to the support team.
</p>
</div>
);
});
Data binding
Your email is: [email protected]
import { component$, useSignal } from '@builder.io/qwik';
import { Textarea, Label } from '~/components/ui';
export default component$(() => {
const valueSig = useSignal('[email protected]');
return (
<div class="grid w-full max-w-sm items-center gap-1.5">
<Label for="email-2">Email</Label>
<Textarea id="email-2" placeholder="Email" bind:value={valueSig} />
<p class="text-sm text-muted-foreground">Your email is: {valueSig.value}</p>
</div>
);
});