Textarea
A multi-line text field for long entries such as notes, addresses and descriptions.
zb:textarea zubazar/ui · free (MIT)
Basic usage
BLADE
Give the height as a number of lines with rows; the default is 4.
<zb:textarea wire:model="note" label="Note" rows="3" placeholder="Note for the warehouse team" />
| Prop | Values |
|---|---|
rows | Number of lines; default 4 |
Initial text
BLADE
In a form without Livewire, write the field's initial value in the slot; with wire:model the value comes from the property.
<zb:textarea name="address" label="Address" rows="3">No. 4, 12th Street, Cumhuriyet Neighborhood, Kadıköy</zb:textarea>
Floating label
BLADE
variant="floating" puts the label inside the field; when the field is focused or filled, the label shrinks up to the top edge.
<zb:textarea wire:model="description" variant="floating" label="Description" rows="3" />
| Prop | Values |
|---|---|
variant | default | floating |
Hint and validation error
BLADE
hint puts help text below the field; if there is an error for the field's name, the message replaces the hint and the border turns red.
<div class="space-y-4">
<zb:textarea wire:model="note" label="Note" rows="3" hint="The courier sees this note during delivery." />
<zb:textarea wire:model="rejection_reason" label="Rejection reason" rows="3" required>Missing</zb:textarea>
</div>
| Prop | Values |
|---|---|
hint | Help text below |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
label | — | null | Label; * is added next to it when the required attribute is present |
name | — | null | Field name; defaults to the wire:model value |
old | boolean | true | false: never the value a failed validation sent back (old()), only value; several forms with fields of the same name (an address list) don't fill each other |
rows | number | 4 | Number of lines |
variant | — | default | default · floating |
hint | — | null | Help text below while there is no error; linked to the field with aria-describedby |
input-class | — | null | Classes of the <textarea> element itself; class places the whole field |
(attributes) | — | — | Layout attributes such as class, style, x-show and wire:key go on the outer element; placeholder, required, disabled, readonly, id, aria-*, data-* … go straight to the <textarea> element |
Slots: default (initial text of the field)
Developer notes
- Label, hint, floating label and error behavior are the same as
zb:input. - The field name and id are derived from
wire:model; attributes such asplaceholdergo straight to the<textarea>element. - A field with a floating label can be resized vertically.
- A field with an error gets
aria-invalid="true"; the hint or message is linked to the field witharia-describedby(id: the field id +-message), and your ownaria-describedbyvalue is kept. disableddraws the field with a gray background and text,readonlywith a gray background; with a floating label,disabledlooks faded.