LaraUI - V1.0

Radio

The <x-xf::radio> component is a flexible Blade component designed to render grouped radio buttons in Laravel forms. It supports default selection, layout customization, label display, and additional attributes — making it ideal for selecting a single value from multiple options.

📄 <x-xf::radio>

📘 Description

The <x-xf::radio> component simplifies the creation of grouped radio buttons using a clean, reusable Blade structure. It allows you to define options dynamically, set default checked values, and control layout direction (block or inline).

This component integrates well with model binding and old input values, and supports additional HTML attributes per input.

✅ Usage Example

<x-xf::radio 
    name="gender" 
    :options="['male' => 'Male', 'female' => 'Female']" 
    :checked="old('gender')" 
    label="Gender" 
    type="inline"
/>

🔑 Props

Name Type Required Default Description
name string The name attribute for all radio inputs (shared group).
options array [] Key-value pairs where the key is the radio value and the value is the label.
checked array|string [] Pre-selected radio value. Can be string or array.
type string 'block' Defines layout type: block (stacked) or inline.
attr array [] Additional HTML attributes to apply to each input.
label string|null null Optional label for the group of radio buttons.

🛡 Features

  • ✅ Grouped radio button rendering
  • ✅ Custom layout: block or inline
  • ✅ Supports dynamic option lists
  • ✅ Works with old() and model binding