Skip to contents

Joins adjoining buttons into a single segmented control: inner corners collapse, the shared 1px border renders once, and the hovered/focused button raises so its full outline shows. Drop in ordinary shad_button()s (any variant; "outline" reads best) plus optional shad_button_group_text() label segments and shad_button_group_separator() hairlines.

Usage

shad_button_group(
  ...,
  orientation = c("horizontal", "vertical"),
  aria_label = NULL,
  class = NULL
)

shad_button_group_separator(class = NULL)

shad_button_group_text(..., class = NULL)

Arguments

...

Buttons and group parts, and/or named HTML attributes.

orientation

"horizontal" (default) or "vertical".

aria_label

Accessible label describing the group.

class

Extra CSS classes.

Value

A button-group tag.

Examples

shad_button_group(
  shad_button("Left", variant = "outline"),
  shad_button("Center", variant = "outline"),
  shad_button("Right", variant = "outline"),
  aria_label = "Text alignment"
)
#> <div class="shad-button-group" role="group" data-orientation="horizontal" aria-label="Text alignment">
#>   <button type="button" class="shad-btn shad-btn--outline">Left</button>
#>   <button type="button" class="shad-btn shad-btn--outline">Center</button>
#>   <button type="button" class="shad-btn shad-btn--outline">Right</button>
#> </div>