- Getting Started
- The Basics
- Concepts
- SuperNative
-
EDGE Components
- Introduction
- Activity Indicator
- Badge
- Bottom Navigation
- Bottom Sheet
- Button
- Button Group
- Canvas
- Carousel
- Checkbox
- Chip
- Column
- Divider
- Gesture Area
- Icon
- Icons
- Image
- Layout & Styling
- List
- Menus
- Modal
- Pressable
- Progress Bar
- Radio Group
- Row
- Scroll View
- Select
- Shapes
- Side Navigation
- Slider
- Spacer
- Stack
- Tab Row
- Text
- Text Input
- Toggle
- Top Bar
- Virtual List
- Web View
- Plugins
- Testing
- Architecture
You're viewing pre-release documentation — version 4.x is in beta
Features, APIs and behaviour may change before the stable release. View the stable version (3.x)
Button Group
Overview#
A segmented single-choice selector. Each option is a pressable pill in a horizontal bar; the active one fills with
theme.primary. The group owns the selected-index state.
Use this for short, mutually-exclusive choices that fit on one row. For more options or longer labels use a
<native:tab-row> or <native:select>.
Copied!
<native:button-group :options="['Daily', 'Weekly', 'Monthly']" native:model="period" />
Props#
options- Array of option labels (required, array of strings)value/selected-index- Currently selected index (optional, int, default:0)disabled- Disable the group (optional, boolean, default:false)a11y-label- Accessibility label (optional)
Events#
@change- Livewire method called when the selection changes. Receives the new index as a parameter
Two-way Binding#
native:model binds the selected index to a Livewire integer property:
Copied!
<native:button-group :options="$tiers" native:model="planTier" />
Examples#
Period picker#
Copied!
<native:button-group :options="['Day', 'Week', 'Month', 'Year']" native:model="period"/>
With manual change handler#
Copied!
<native:button-group :options="['Easy', 'Medium', 'Hard']" :value="$difficulty" @change="setDifficulty"/>
Element#
Copied!
use Nativephp\NativeUi\Elements\ButtonGroup; ButtonGroup::make() ->options(['Daily', 'Weekly', 'Monthly']) ->selectedIndex(1) ->onChange('setPeriod');
make()- Create a button groupoptions(array $options)- Option labelsselectedIndex(int $index)- Currently selected indexdisabled(bool $value = true)- Disable the groupa11yLabel(string $value)- Accessibility labelsyncMode(string $mode)-live | blur | debounce(set bynative:modelmodifiers)onChange(string $method)- Livewire method invoked on change
Plugin Dev Kit
Build native plugins with
Claude Code
Learn More
NativePHP Ultra
All NativePHP plugins, teams & priority support from
$35/mo
Learn More
The Vibes
The unofficial Laracon US
Day 3
Grab Your Spot
Only 100 tickets!
The Masterclass
Go from zero to
published app
in no time
in no time
Learn More
Early Bird Pricing