beartropy/ui
Beartropy UI is a small Laravel UI package providing ready-made components and helpers to speed up building admin and front-end screens. Drop in common layouts, forms, and UI utilities to get a consistent look fast with minimal setup.
<x-bt-textarea />
Textarea → extends BeartropyComponenttextarea.blade.phpresources/views/presets/textarea.php (24 color variants)resources/views/presets/sizes.phpresources/css/beartropy-ui.css (.beartropy-textarea focus reset, .beartropy-thin-scrollbar)support/field-help.blade.php for error and help text below fieldx-data in Blade (no separate JS module) — handles character count and copy-to-clipboard| Prop | PHP Type | Default | Blade Attribute |
|---|---|---|---|
| label | ?string |
null |
label="Description" |
| placeholder | string |
'' |
placeholder="Enter text..." |
| rows | int |
4 |
:rows="8" |
| cols | ?int |
null |
:cols="50" |
| name | ?string |
null |
name="bio" |
| id | ?string |
null |
id="my-textarea" |
| color | ?string |
null |
color="blue" or magic: blue |
| size | ?string |
null |
size="lg" or magic: lg |
| disabled | bool |
false |
:disabled="true" |
| readonly | bool |
false |
:readonly="true" |
| required | bool |
false |
:required="true" |
| help | ?string |
null |
help="Help text" |
| hint | ?string |
null |
hint="Help text" |
| customError | mixed |
null |
:custom-error="$error" |
| autoResize | bool |
false |
:auto-resize="true" |
| resize | ?string |
null |
resize="both" |
| showCounter | bool |
true |
:show-counter="false" |
| maxLength | ?int |
null |
:max-length="500" |
| showCopyButton | bool |
true |
:show-copy-button="false" |
primary via config)primary, beartropy, red, blue, green, yellow, purple, pink, gray, orange, amber, lime, emerald, teal, cyan, sky, indigo, violet, rose, fuchsia, slate, stone, zinc, neutral
md)xs, sm, md, lg, xl
| Slot | Description |
|---|---|
| default | Initial textarea content/value |
The component uses inline Alpine.js on the wrapper <div>:
count — current character count, initialized from $refs.textarea.value.lengthcopySuccess — brief true flag after clipboard copy (resets after 1.6s)copy() — writes $refs.textarea.value to clipboard via navigator.clipboard.writeText()x-init on the wrapper reads initial count from $refs.textareax-on:input on the <textarea> updates count on each keystrokeautoResize is enabled, the same x-on:input handler also adjusts $el.style.heightThe Blade template maps resize prop values to Tailwind v4 classes:
| Prop Value | Tailwind Class | Behavior |
|---|---|---|
none |
resize-none |
No resize |
x |
resize-x |
Horizontal only |
y |
resize-y |
Vertical only |
both |
resize |
Both directions |
| (not set) | resize-y |
Default: vertical only |
| (not set, autoResize=true) | resize-none |
Disabled when auto-resize is on |
colors → {color} → {
main, border_default, border_error,
label, label_error,
input,
help, error
}
main — wrapper div styling: bg, text, border, rounded, shadow, focus-within ringborder_default / border_error — border and ring colors for normal/error stateslabel / label_error — label typography and colorinput — native textarea styling: beartropy-textarea class for focus reset, bg transparent, text color$errors bag for field name or wire:model valuecustomError propborder_error preset, label switches to label_errorfield-help component below the textareaabsolute top-2 right-3 inside the wrapperx-tooltip.raw for hover tooltiptabindex="-1" to skip in tab orderpr-12 padding to avoid overlapabsolute bottom-3.5 right-3count alone, or count / maxLength when maxLength is settext-red-500) when count reaches maxLength$countBlade for initial render before Alpine hydrates{{-- Basic --}}
<x-bt-textarea name="notes" label="Notes" placeholder="Enter notes..." />
{{-- With character limit --}}
<x-bt-textarea name="bio" label="Bio" :max-length="500" />
{{-- Auto-resize --}}
<x-bt-textarea name="content" :auto-resize="true" label="Content" />
{{-- Minimal (no copy, no counter) --}}
<x-bt-textarea name="data" :show-counter="false" :show-copy-button="false" />
{{-- Livewire --}}
<x-bt-textarea wire:model="description" label="Description" />
{{-- With help text --}}
<x-bt-textarea name="notes" label="Notes" help="Be concise" />
{{-- Custom error --}}
<x-bt-textarea name="bio" :custom-error="'Bio is required'" />
{{-- Colored --}}
<x-bt-textarea blue name="notes" label="Notes" />
{{-- Initial content via slot --}}
<x-bt-textarea name="bio" label="Bio">Default text here</x-bt-textarea>
{{-- Disabled --}}
<x-bt-textarea name="locked" :disabled="true" label="Locked" />
'textarea' => [
'color' => env('BEARTROPY_UI_TEXTAREA_COLOR', 'primary'),
'size' => env('BEARTROPY_UI_TEXTAREA_SIZE', 'md'),
],
help and hint are aliases; help takes precedence in the field-help componentbeartropy-textarea CSS class only resets focus outline/shadow — all other styling comes from Tailwind classes in the presetwire:model, spellcheck, data-*, etc.) are forwarded to the native <textarea> via $attributes->merge()old($name, $slot) — respects Laravel's form repopulation after validation failuresid defaults to $name if set, otherwise uniqid('textarea-')required adds both the HTML attribute and a red asterisk on the labelHow can I help you explore Laravel packages today?