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-checkbox />
Checkbox → extends BeartropyComponentcheckbox.blade.phpresources/views/presets/checkbox.php (25 color variants)resources/views/presets/sizes.phpsupport/field-help.blade.php for error and help text below fieldpeer-checked: for state| Prop | PHP Type | Default | Blade Attribute |
|---|---|---|---|
| id | ?string |
auto-generated | id="my-checkbox" |
| name | ?string |
null |
name="terms" |
| value | mixed |
null |
value="1" |
| checked | bool |
false |
:checked="true" |
| disabled | bool |
false |
:disabled="true" |
| color | ?string |
null |
color="blue" or magic: blue |
| size | ?string |
null |
size="lg" or magic: lg |
| customError | mixed |
null |
:custom-error="$error" |
| label | ?string |
null |
label="Accept" |
| labelPosition | string |
'right' |
label-position="left" |
| help | ?string |
null |
help="Help text" |
| hint | ?string |
null |
hint="Hint text" |
beartropy 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 | Label content override (takes precedence over label prop). Supports rich HTML. |
class and style → outer wrapper <div> (merged with flex flex-col min-h-full justify-center)<input type="checkbox"> (merged with peer sr-only, disabled, checked, value)colors → {color} → {
checked, bg, border, border_error,
hover, focus, focus_error,
active, disabled,
label, label_error
}
checked — peer-checked:border-{color}-600 peer-checked:bg-{color}-600border / border_error — border width + color for normal/error stateshover — border and bg change on hoverfocus / focus_error — ring for keyboard focusactive — pressed state stylingdisabled — opacity-60 cursor-not-allowedlabel / label_error — label text color for normal/error statesxs, sm, md → rounded-smlg, xl → rounded-md$errors bag for field name or wire:model valuecustomError propborder_error, focus to focus_error, label to label_errorfield-help component below the checkboxM4 8l3 3 5-5peer-checked:scale-100 transition (from scale-0) for animationtext-white), dark neutral on dark (dark:text-neutral-900){{-- Basic --}}
<x-bt-checkbox label="Accept terms" />
{{-- With name and value --}}
<x-bt-checkbox name="role" value="admin" label="Admin" />
{{-- Pre-checked --}}
<x-bt-checkbox label="Checked" :checked="true" />
{{-- Colored --}}
<x-bt-checkbox blue label="Blue checkbox" />
{{-- Sized --}}
<x-bt-checkbox lg label="Large checkbox" />
{{-- Label on left --}}
<x-bt-checkbox label="Left label" label-position="left" />
{{-- Rich label via slot --}}
<x-bt-checkbox name="tos">
I accept the <a href="/terms" class="underline">Terms</a>
</x-bt-checkbox>
{{-- Disabled --}}
<x-bt-checkbox label="Locked" :disabled="true" :checked="true" />
{{-- With help text --}}
<x-bt-checkbox label="Notifications" help="Email and push notifications." />
{{-- Custom error --}}
<x-bt-checkbox label="Accept" :custom-error="'Required'" />
{{-- Livewire --}}
<x-bt-checkbox wire:model="accepted" label="Accept" />
{{-- Livewire live --}}
<x-bt-checkbox wire:model.live="newsletter" label="Newsletter" />
{{-- Custom attributes --}}
<x-bt-checkbox label="Custom" data-testid="checkbox" aria-label="Accept" />
'checkbox' => [
'color' => env('BEARTROPY_UI_CHECKBOX_COLOR', 'beartropy'),
'size' => env('BEARTROPY_UI_CHECKBOX_SIZE', 'md'),
],
peer/peer-checked: selectors on the hidden <input><input> is sr-only (visually hidden but accessible) — the visible checkbox is a styled <span>id auto-generates as beartropy-checkbox-{uniqid} if not providedhelp and hint are aliases; help takes precedence in the field-help componentlabel prop (checked via trim($slot) !== '')wire:model, data-*, aria-*, etc.) are forwarded to the native <input> via $attributes->except(['class', 'style'])primary preset maps to beartropy colors — identical to beartropy presetHow can I help you explore Laravel packages today?