3.0.19 • Published 3 months ago

@vrembem/button-group v3.0.19

Weekly downloads
4
License
MIT
Repository
github
Last release
3 months ago

Button-group

A component for displaying groups of buttons.

npm version

Documentation

Installation

npm install @vrembem/button-group

Styles

@use "@vrembem/button-group";

Markup

The most basic implementation of the button-group component consists of the button-group container wrapping a group of buttons.

<div class="button-group">
  <button class="button">...</button>
  <button class="button">...</button>
  <button class="button">...</button>
</div>

Button-groups that are siblings to one another will inherit the gap provided by the adjacent sibling.

<div class="button-group">
  <button class="button">...</button>
  ...
</div>
<div class="button-group">
  <button class="button">...</button>
  ...
</div>

Modifiers

button-group_full_[key]

A modifier to allow a button-group to span the full width of it's container. Values and class keys are generated using the $breakpoints map. Omitting the key value from the modifier (e.g. button-group_full) will stack items under all conditions.

<div class="button-group button-group_full_md">
  <button class="button">...</button>
  <button class="button">...</button>
  <button class="button">...</button>
</div>

Available Variations

  • button-group_full
  • button-group_full_xs
  • button-group_full_sm
  • button-group_full_md
  • button-group_full_lg
  • button-group_full_xl

button-group_gap_[key]

Adjusts the gap spacing based on the provided key. Gap key output is based on the values in $gap-map variable map.

<div class="button-group button-group_gap_xs">
  <button class="button">...</button>
  <button class="button">...</button>
  <button class="button">...</button>
</div>

Available Variations

  • button-group_gap_none
  • button-group_gap_xs
  • button-group_gap_sm
  • button-group_gap_md
  • button-group_gap_lg
  • button-group_gap_xl

button-group_join

A modifier to join buttons without a button-group component. This removes all gap spacing and adjusts the border-radius to allow buttons to be visually be joined as a single unit.

<div class="button-group button-group_join">
  <button class="button">...</button>
  <button class="button">...</button>
  <button class="button">...</button>
</div>

button-group_stack_[key]

Adds a breakpoint for when button-group elements should be stacked vertically. Values and class keys are generated using the $breakpoints map. Omitting the key value from the modifier (e.g. button-group_stack) will stack items under all conditions.

<div class="button-group button-group_stack_md">
  <button class="button">...</button>
  <button class="button">...</button>
  <button class="button">...</button>
</div>

Available Variations

  • button-group_stack
  • button-group_stack_xs
  • button-group_stack_sm
  • button-group_stack_md
  • button-group_stack_lg
  • button-group_stack_xl

Customization

Sass Variables

VariableDefaultDescription
$prefix-blocknullString to prefix blocks with.
$prefix-element"__"String to prefix elements with.
$prefix-modifier"_"String to prefix modifiers with.
$prefix-modifier-value"_"String to prefix modifier values with.
$breakpointscore.$breakpoints Ref The breakpoints map the button-group_full_[key] and button-group_stack_[key] modifiers use to build their styles.
$border-radiuscore.$border-radiusSets the border-radius styles of buttons when button-group adjusts them.
$gap0.5emThe default gap spacing for the button-group component.
$gap-join-1pxThe gap spacing used for the button-group_join modifier.
$gap-mapSass Map Ref Used to output gap modifiers.

$breakpoints

The breakpoints map the button-group_full_[key] and button-group_stack_[key] modifiers use to build their styles.

// Inherited from: core.$breakpoints
$breakpoints: (
  "xs": 480px,
  "sm": 620px,
  "md": 760px,
  "lg": 990px,
  "xl": 1380px
) !default;

$gap-map

Used to output gap modifiers.

$gap-map: (
  "none": 0,
  "xs": 1px,
  "sm": 0.25em,
  "md": 0.5em,
  "lg": 1em,
  "xl": 1.5em,
) !default;
3.0.19

3 months ago

3.0.18

4 months ago

3.0.13

10 months ago

3.0.16

8 months ago

3.0.17

8 months ago

3.0.14

10 months ago

3.0.11

1 year ago

3.0.10

2 years ago

3.0.9

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.0

2 years ago

2.0.0

2 years ago

1.39.0

2 years ago

1.40.2

2 years ago

1.41.0

2 years ago

1.40.1

2 years ago

1.38.0

2 years ago

1.37.0

2 years ago

1.36.1

3 years ago

1.34.0

3 years ago

1.33.2

3 years ago

1.32.2

3 years ago

1.32.0

3 years ago

1.29.0

3 years ago

1.30.0

3 years ago

1.28.0

3 years ago

1.22.3

4 years ago

1.22.2

4 years ago

1.22.1

4 years ago

1.21.0

4 years ago

1.19.0

4 years ago

1.18.1

4 years ago

1.18.2

4 years ago

1.18.0

4 years ago

1.17.0

4 years ago

1.15.5

4 years ago

1.15.2

4 years ago

1.15.0

4 years ago

1.14.8

4 years ago

1.14.5

4 years ago

1.14.2

4 years ago

1.10.0

4 years ago

1.8.3

4 years ago

1.7.3

4 years ago

1.7.2

4 years ago

1.5.4

4 years ago

1.5.3

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago