{{-- An M3 Expressive button group: related ``s in a row. Standard (the default): the buttons stand apart, and pressing a label button widens it while its neighbours give way. `connected`: 2px apart with small inner corners, the shape that replaced M3's segmented button; a selected (aria-pressed) button rounds fully. Give `size` the size of the buttons inside, so the spacing and corners match. For a choice bound to a property, `` draws a connected group of radios. A group never wraps to a second line — M3's rule, and the press expansion only reaches a neighbour on the same line anyway. Where a row is too long for its window the answer is a smaller `size` or fewer buttons, or two groups stacked. Spacing from the M3 Expressive spec (ButtonGroupSmallTokens: 12px at the small size). The shapes are resources/css/components/groups.css. --}} @props([ 'connected' => false, 'size' => 'sm', 'label' => null, ]) @php $size = in_array($size, ['xs', 'sm', 'md', 'lg', 'xl'], true) ? $size : 'sm'; @endphp
class([ 'inline-flex items-center', 'gap-0.5' => $connected, 'gap-[18px]' => ! $connected && $size === 'xs', 'gap-3' => ! $connected && $size === 'sm', 'gap-2' => ! $connected && in_array($size, ['md', 'lg', 'xl'], true), ]) }} > {{ $slot }}