Skip to content

Button Group ​

The ButtonGroup component can be used to group related buttons.

Importing ​

To use the button group component, first you need to register the component inside the page. You can register the component manually by importing the register function:

ts
import { register } from "@tapsioss/web-components/button-group";

register(); // Now the button group component is ready to use!
ts
import { registerButtonGroup } from "@tapsioss/web-components";

registerButtonGroup(); // Now the button group component is ready to use!

Also you can automatically register the component by importing it with the following approach:

ts
import "@tapsioss/web-components/button-group/element";

TIP

If you want to use all the component in your app, you can call registerAll at the root of your project.

ts
import { registerAll } from "@tapsioss/web-components";

registerAll(); // All the components are now available

In the React package, you can easily add the component using the following code:

ts
import { ButtonGroup } from "@tapsioss/react-components";

Component Usage ​

html
<tapsi-button-group></tapsi-button-group>
tsx
<ButtonGroup />

Properties ​

NameAttribute NameDescriptionTypeDefault Value
orientationorientationDefines the orientation of the button group."horizontal" | "vertical""horizontal"
alignmentalignmentSets the alignment of the items within the button group."center" | "start""start"
fluidItemsfluid-itemsIf true, the items in the button group will expand to fill the available space.booleanfalse
labellabelDefines a string value that can be used to set a label
for assistive technologies.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label
string""

Slots ​

NameValueDescription
DEFAULT-The default slot for the content.

TIP

The value of slots are available for developer as JavaScript Variables:

ts
// Option 1
import { ButtonGroupSlots } from "@tapsioss/web-components";

// Option 2
import { Slots } from "@tapsioss/web-components/button-group";
ts
// Option 1
import { ButtonGroupSlots } from "@tapsioss/react-components";

// Option 2
import { Slots } from "@tapsioss/react-components/ButtonGroup";

Created with 🧡