Actions.toggle_group
Server-rendered
Groups toggles in either single-select or multi-select mode.
This component provides structure and classes only. State management should be handled by LiveView assigns or JS hooks.
Single-select alignment controls
<.toggle_group type={:single}>
<.toggle>Left</.toggle>
<.toggle pressed={true}>Center</.toggle>
<.toggle>Right</.toggle>
</.toggle_group>
Multi-select text formatting
<.toggle_group type={:multiple}>
<.toggle pressed={true}>Bold</.toggle>
<.toggle>Italic</.toggle>
<.toggle pressed={true}>Underline</.toggle>
</.toggle_group>
Vertical stack
<.toggle_group orientation={:vertical} class="items-start">
<.toggle>Alpha</.toggle>
<.toggle pressed={true}>Beta</.toggle>
<.toggle>Gamma</.toggle>
</.toggle_group>
Attributes
| Name | Type | Default | Values | Global Includes |
|---|---|---|---|---|
class
|
:string |
— | — | — |
orientation
|
:atom |
:horizontal
|
:horizontal
,
:vertical
|
— |
rest
|
:global |
— | — | — |
type
|
:atom |
:single
|
:single
,
:multiple
|
— |
Slots
| Slot | Slot Attributes |
|---|---|
inner_block
Required
|
— |