Tooltip

Installation

  yarn add @chewy/kib-tooltip-styles

Import

  @use '~@chewy/kib-tooltip-styles/src/styles' as kib-tooltip;

Mixins

tooltip

@mixin tooltip() { ... }@mixin tooltip() { 
  @include typography.style-as('paragraph-1');

  padding: spacing.get('s4');
  display: none;
  z-index: 4;
  max-width: settings.$max-width;
  border-radius: settings.$border-radius;
  border: settings.$border-width solid settings.$border-color;
  background-color: settings.$background-color;
  color: settings.$text-color;
 }
Description

Root tooltip styles

Parameters

None.

Requires

show

@mixin show() { ... }@mixin show() { 
  display: block;
 }
Description

Show popper styles

Parameters

None.

sr-only

@mixin sr-only() { ... }@mixin sr-only() { 
  display: none;
 }
Description

Screen reader only content styles

Parameters

None.

content-arrow

@mixin content-arrow() { ... }@mixin content-arrow() { 
  $width: settings.$arrow-size * 0.5;

  position: absolute;
  width: 0;
  height: 0;
  border: $width solid transparent;
  transform-style: preserve-3d;

  #{$content-selector}[data-popper-placement^='top'] & {
    top: 100%;
    border-bottom: 0;
    border-top-color: settings.$background-color;
  }

  #{$content-selector}[data-popper-placement^='left'] & {
    left: 100%;
    border-right: 0;
    border-left-color: settings.$background-color;
  }

  #{$content-selector}[data-popper-placement^='right'] & {
    right: 100%;
    border-left: 0;
    border-right-color: settings.$background-color;
  }

  #{$content-selector}[data-popper-placement^='bottom'] & {
    bottom: 100%;
    border-top: 0;
    border-bottom-color: settings.$background-color;
  }

  // Arrow border for contrast
  &::after {
    position: inherit;
    border: inherit;
    content: '';
    transform: translateZ(-1px);

    #{$content-selector}[data-popper-placement^='top'] & {
      bottom: settings.$border-width * -1;
      left: $width * -1;
      border-top-color: settings.$border-color;
    }

    #{$content-selector}[data-popper-placement^='left'] & {
      right: settings.$border-width * -1;
      top: $width * -1;
      border-left-color: settings.$border-color;
    }

    #{$content-selector}[data-popper-placement^='right'] & {
      left: settings.$border-width * -1;
      top: $width * -1;
      border-right-color: settings.$border-color;
    }

    #{$content-selector}[data-popper-placement^='bottom'] & {
      top: settings.$border-width * -1;
      left: $width * -1;
      border-bottom-color: settings.$border-color;
    }
  }
 }
Description

Popper arrow attached to content wrapper

Parameters

None.

Requires

Variables

max-width

$max-width: unit.rem(288px) !default;
Description

Popper max width

background-color

$background-color: color.get('ui-bg', '02') !default;
Description

Popper background color

Type

Color

border-color

$border-color: color.get('ui-bg', '05') !default;
Description

Popper border color

Type

Color

border-radius

$border-radius: kib-core.dimensions-get(small) !default;
Description

Popper border radius

Type

Number

border-width

$border-width: unit.rem(1px) !default;
Description

Popper border width

Type

Number

text-color

$text-color: color.get('text', 'primary') !default;
Description

Popper text color

Type

Color

width-default

$width-default: unit.rem(224px) !default;
Description

Popper default maximum width

Type

Number

width-large

$width-large: unit.rem(328px) !default;
Description

Large modifier maximum width

Type

Number

width-huge

$width-huge: unit.rem(480px) !default;
Description

Huge modifier maximum width

Type

Number

width-giant

$width-giant: unit.rem(960px) !default;
Description

Giant modifier maximum width

Type

Number

arrow-size

$arrow-size: kib-core.dimensions-get(large) !default;
Description

Popper arrow size. Equal height/width only.

Type

Number

z-index

$z-index: kib-core.zindex-get(kib-popper) !default;
Description

Popper stacking z-index

Type

Number

close-icon-color

$close-icon-color: currentColor !default;
Description

Popper close svg fill color

Type

Color

close-icon-size

$close-icon-size: kib-core.dimensions-get(default) !default;
Description

Popper close icon svg size

Type

Number

close-position

$close-position: kib-core.dimensions-get(small) !default;
Description

Popper close trigger position

Type

Number