v0.0.2
Demos (demo panel, opens in a new tab)

Textarea

A multi-line text field for long entries such as notes, addresses and descriptions.

zb:textarea zubazar/ui · free (MIT)

Basic usage

Basic usage: view
BLADE

Give the height as a number of lines with rows; the default is 4.

blade
<zb:textarea wire:model="note" label="Note" rows="3" placeholder="Note for the warehouse team" />
PropValues
rowsNumber of lines; default 4

Initial text

Initial text: view
BLADE

In a form without Livewire, write the field's initial value in the slot; with wire:model the value comes from the property.

blade
<zb:textarea name="address" label="Address" rows="3">No. 4, 12th Street, Cumhuriyet Neighborhood, Kadıköy</zb:textarea>

Floating label

Floating label: view
BLADE

variant="floating" puts the label inside the field; when the field is focused or filled, the label shrinks up to the top edge.

blade
<zb:textarea wire:model="description" variant="floating" label="Description" rows="3" />
PropValues
variantdefault | floating

Hint and validation error

Hint and validation error: view
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.

blade
<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>
PropValues
hintHelp text below

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
label—nullLabel; * is added next to it when the required attribute is present
name—nullField name; defaults to the wire:model value
oldbooleantruefalse: 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
rowsnumber4Number of lines
variant—defaultdefault · floating
hint—nullHelp text below while there is no error; linked to the field with aria-describedby
input-class—nullClasses 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

Events, hooks and details
  • 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 as placeholder go 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 with aria-describedby (id: the field id + -message), and your own aria-describedby value is kept.
  • disabled draws the field with a gray background and text, readonly with a gray background; with a floating label, disabled looks faded.
Zubazar UI · ZubazarDesigned for people.