Textarea
Displays a textarea, or a component that looks like one.
Installation
Shadwire follows shadcn/ui's open code model: the component's source is copied into your application and becomes yours. Install it with the CLI:
The textarea registry item installs these files:
-
app/components/ui_component.rb -
app/components/ui/textarea_component.rb -
app/helpers/ui/textarea_helper.rb -
vendor/shadwire/shadwire.css
Haven't installed the CLI yet? gem install shadwire, then shadwire init.
Usage
Use the ui_textarea helper
in any view. The block becomes the textarea's initial value.
Or render the component
Ui::TextareaComponent
directly:
Examples
Default
A textarea in the shadcn style. It grows with its content, using field-sizing.
With a label
Pair it with ui_label for accessible forms.
Disabled
Pass disabled: true as an HTML attribute.
API reference
ui_textarea(**options, &block)
wraps
Ui::TextareaComponent.new(**options).
| Argument | Type | Default | Description |
|---|---|---|---|
class / class_name |
String | nil |
Extra classes, merged after the base classes. |
**attrs |
Hash | {} |
Free HTML attributes (name, rows, placeholder, disabled, data:, aria:, …). |
&block |
Block | — | The textarea's initial value. |