3.0.19 • Published 3 months ago

@vrembem/icon-action v3.0.19

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

Icon-action

A component for displaying simple action buttons using icons.

npm version

Documentation

Installation

npm install @vrembem/icon-action

Styles

@use "@vrembem/icon-action";

Markup

The icon-action component consists of two parts, the icon-action and it's child icon component. Because icon-actions only contain an icon as its content, it's important to add an aria-label attribute with a label of what the action does for accessibility.

<button class="icon-action" aria-label="Close button">
  <svg role="img" class="icon">
    <!-- SVG markup or link ID goes here... -->
  </svg>
</button>

Disabled

When disabled using the disabled attribute, an icon-action will inherit styles to visually appear noninteractive.

<button class="icon-action" disabled>
  <svg role="img" class="icon">
    <!-- SVG markup or link ID goes here... -->
  </svg>
</button>

Loading

Icon-actions can also have a loading state by adding the is-loading state class. This is useful when an icon-action has an action that has a delayed response in order to give users a visual indicator that their action is being processed.

<button class="icon-action is-loading" disabled>
  <svg role="img" class="icon">
    <!-- SVG markup or link ID goes here... -->
  </svg>
</button>

Modifiers

icon-action_invert

A boolean icon-action modifier that allows icon-actions and their modifiers to provide an inversed version of themselves. Since not all icon-action styles require an inversed variant, this is typically used for when the background context of a button matters. Can be combined with icon-action_subtle boolean modifier.

<button class="icon-action icon-action_invert" aria-label="...">
  ...
</button>

Available Combinations

  • icon-action icon-action_invert
  • icon-action icon-action_invert icon-action_subtle

icon-action_state_[value]

Adds styles for changing the look and feel of an icon-action to better reflect the urgency or status of the action.

<button class="icon-action icon-action_state_info" aria-label="...">
  ...
</button>

Available Variations

  • icon-action_state_info
  • icon-action_state_success
  • icon-action_state_caution
  • icon-action_state_danger

icon-action_subtle

A boolean icon-action modifier that allows icon-actions and their modifiers to provide a more subtle version of themselves. Can be combined with icon-action_invert boolean modifier.

<button class="icon-action icon-action_subtle" aria-label="...">
  ...
</button>

Available Combinations

  • icon-action icon-action_subtle
  • icon-action icon-action_subtle icon-action_invert

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.
$size(core.$font-size * core.$line-height)Sets the width and height properties.
$transition-propertybox-shadow, outline, outline-offsetSets the transition-property property.
$transition-durationcore.$transition-duration-shortSets the transition-duration property.
$transition-timing-functioncore.$transition-timing-functionSets the transition-timing-function property.
$border-radiuscore.$border-radius-circle 9999pxSets the border-radius property.
$bordernullSets the border property.
$border-color-hovernullSets the border-color property on :hover state.
$border-color-focusnullSets the border-color property on :focus state.
$border-color-activenullSets the border-color property on :active state.
$backgroundrgba(core.$black, 0.4)Sets the background property.
$background-hoverrgba(core.$black, 0.5)Sets the background property on :hover state.
$background-focusrgba(core.$black, 0.5)Sets the background property on :focus state.
$background-activergba(core.$black, 0.6)Sets the background property on :active state.
$box-shadow0 0 0 0 rgba(core.$black, 0)Sets the box-shadow property.
$box-shadow-hovernullSets the box-shadow property on :hover state.
$box-shadow-focus0 0 0 0.2rem rgba(core.$black, 0.2)Sets the box-shadow property on :focus state.
$box-shadow-activenullSets the box-shadow property on :active state.
$colorcore.$color-invertSets the color property.
$color-hovernullSets the color property on :hover state.
$color-focusnullSets the color property on :focus state.
$color-activenullSets the color property on :active state.
$outlinenoneSets the outline property.
$outline-hovernullSets the outline property on :hover state.
$outline-focusnullSets the outline property on :focus state.
$outline-activenullSets the outline property on :active state.
$outline-offsetnullSets the outline-offset property.
$outline-offset-hovernullSets the outline-offset property on :hover state.
$outline-offset-focusnullSets the outline-offset property on :focus state.
$outline-offset-activenullSets the outline-offset property on :active state.
$icon-stroke-width2.5pxSets the stroke-width property on the child icon component.
$icon-font-sizecore.$font-size-smSets the font-size property on the child icon component.
$disabled-opacity0.6Sets the opacity property when disabled attribute is applied.
$loading-size0.7emSets the size of the loading spinner.
$loading-animation-duration0.6sSets the animation-duration property of the loading spinner.
$loading-border-color$colorSets the border-color property of the loading spinner.
$loading-border2px solidSets the border property of the loading spinner.
$loading-border-tpl1 1 0 0The template for where to apply the border-color property. Takes boolean 1 and 0 values for top, right, bottom and left borders respectively.
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

4.0.0-next.1

10 months ago

4.0.0-next.0

10 months ago

4.0.0-alpha.1

1 year ago

4.0.0-alpha.0

1 year 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.2

3 years ago

1.34.0

3 years ago

1.34.1

3 years ago

1.33.2

3 years ago

1.33.1

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.26.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.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.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