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-radio-group />
RadioGroup → extends BeartropyComponentradio-group.blade.php<x-beartropy-ui::radio> for each option (with :grouped="true")resources/views/presets/radio.php (same as Radio)resources/views/presets/sizes.phpsupport/field-help.blade.php for group-level error and help text| Prop | PHP Type | Default | Blade Attribute |
|---|---|---|---|
| name | string |
'' |
name="plan" |
| options | array |
[] |
:options="$options" |
| color | ?string |
null |
color="blue" |
| size | ?string |
null |
size="lg" |
| inline | bool |
false |
:inline="true" |
| disabled | bool |
false |
:disabled="true" |
| required | bool |
false |
:required="true" |
| value | mixed |
null |
value="pro" |
| customError | mixed |
null |
:custom-error="$error" |
| label | ?string |
null |
label="Choose" |
| help | ?string |
null |
help="Help text" |
| hint | ?string |
null |
hint="Hint text" |
[
['value' => 'free', 'label' => 'Free Plan'],
['value' => 'pro', 'label' => 'Pro Plan'],
]
Each option requires value; label defaults to '' if missing.
inline |
Layout | CSS |
|---|---|---|
false (default) |
Vertical stack | flex flex-col gap-2 |
true |
Horizontal wrap | flex gap-4 flex-wrap |
The value prop pre-checks the matching radio via :checked="(string) $value === (string) $option['value']".
Each <x-beartropy-ui::radio> receives:
name, value, label — from the optioncolor, size — from group props (defaults to beartropy / md):disabled — from group prop:grouped="true" — suppresses individual field-help:checked — based on $value matchwire:model — forwarded via $attributes->whereStartsWith('wire:model')When $label is set, renders a <span> above the options with error-aware styling. When $required is true, adds a red asterisk.
$errors bag for field name or wire:model valuecustomError prop:grouped="true"){{-- Basic vertical --}}
<x-bt-radio-group name="plan" :options="$options" />
{{-- Inline --}}
<x-bt-radio-group name="plan" :inline="true" :options="$options" />
{{-- With default value --}}
<x-bt-radio-group name="plan" value="pro" :options="$options" />
{{-- With label --}}
<x-bt-radio-group name="plan" label="Choose a plan" :options="$options" />
{{-- Required --}}
<x-bt-radio-group name="plan" label="Plan" :required="true" :options="$options" />
{{-- Colored --}}
<x-bt-radio-group name="plan" color="blue" :options="$options" />
{{-- Sized --}}
<x-bt-radio-group name="plan" size="lg" :options="$options" />
{{-- Disabled --}}
<x-bt-radio-group name="plan" :disabled="true" :options="$options" />
{{-- With help text --}}
<x-bt-radio-group name="plan" help="Pick one." :options="$options" />
{{-- Custom error --}}
<x-bt-radio-group name="plan" :custom-error="'Required'" :options="$options" />
{{-- Livewire --}}
<x-bt-radio-group name="plan" :options="$options" wire:model="plan" />
{{-- Livewire live --}}
<x-bt-radio-group name="plan" :options="$options" wire:model.live="plan" />
{{-- Combined --}}
<x-bt-radio-group
name="plan"
label="Subscription"
:required="true"
:inline="true"
color="blue"
size="lg"
value="pro"
help="Choose wisely."
:options="$options"
wire:model.live="plan"
/>
Uses the Radio component config:
'radio' => [
'color' => env('BEARTROPY_UI_RADIO_COLOR', 'beartropy'),
'size' => env('BEARTROPY_UI_RADIO_SIZE', 'md'),
],
radio.php presetswire:model variants are forwarded to child radios via $attributes->whereStartsWith('wire:model')class and style are applied to the inner options wrapper <div>, not the outer roothelp and hint are aliases; help takes precedence:grouped="true" — only the group shows errors/helpvalue prop comparison uses string casting: (string) $value === (string) $option['value']primary preset maps to beartropy colors in the radio preset fileHow can I help you explore Laravel packages today?