Choices
Installation
yarn add @chewy/kib-choices-stylesImport
@use '~@chewy/kib-choices-styles/src/styles' as kib-choices;Mixins
choice-root
@mixin choice-root() { ... }@mixin choice-root() { margin-bottom: spacing.get('s4'); }
choice-field
@mixin choice-field() { ... }@mixin choice-field() { position: relative; display: flex; align-items: center; }
Description
Field wrapper of choice control and label
Parameters
None.
choice-control-native
@mixin choice-control-native($width, $height) { ... }@mixin choice-control-native($width, $height) { position: absolute; margin: 0; width: $width; height: $height; appearance: none; cursor: pointer; opacity: 0; &:disabled { pointer-events: none; } }
choice-control-custom
@mixin choice-control-custom($block, $width, $height) { ... }@mixin choice-control-custom($block, $width, $height) { position: relative; display: block; width: $width; height: $height; border: settings.$border-width solid settings.$border-color; border-radius: 50%; flex-shrink: 0; pointer-events: none; &::after { $distance: settings.$border-width * -3; position: absolute; top: $distance; left: $distance; right: $distance; bottom: $distance; border: settings.$border-width solid settings.$outline-color; border-radius: 50%; content: ''; opacity: 0; transform: scale(0.75); transition-property: opacity, transform; transition-duration: 0.2s; } #{$block}__native:focus ~ & { border-color: settings.$border-color-focus; &::after { opacity: 1; transform: scale(1); } } #{$block}__native:checked ~ & { border-color: settings.$border-color-checked; } #{$block}__native:disabled ~ & { opacity: 0.5; pointer-events: none; } #{$block}__native:disabled:not(:checked) ~ & { background-color: settings.$disabled-background-color; } }
Description
Common custom input control styles with various states
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$block | root class of parent block element | String | — none |
$width | input control width | Number | — none |
$height | input control height | Number | — none |
Requires
- [variable]
width - [variable]
height - [variable]
border-width - [variable]
border-color - [variable]
outline-color - [variable]
border-color-focus - [variable]
border-color-checked - [variable]
disabled-background-color
choice-label
@mixin choice-label() { ... }@mixin choice-label() { @include typography.style-as('paragraph-1'); margin-left: settings.$label-spacing; color: settings.$label-text-color; cursor: pointer; #{$block}__native:disabled ~ & { color: settings.$label-text-color-disabled; pointer-events: none; } }
Description
Base styles for choice labels
Parameters
None.
Requires
- [variable]
label-spacing - [variable]
label-text-color - [variable]
label-text-color-disabled
choice-append-container
@mixin choice-append-container($width) { ... }@mixin choice-append-container($width) { margin-top: spacing.get('s2'); padding-left: calc(#{$width} + #{settings.$label-spacing}); }
Description
Container that holds appended content below choice label
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$width | input control width | Number | — none |
Requires
- [function]
get - [variable]
width - [variable]
label-spacing
Variables
brand
$brand: color.get('action', 'selection-control', 'on', 'primary') !default;Description
Brand color applied to the components
Type
Color
Used by
- [mixin]
checkbox-control-fill - [mixin]
radio-control-fill - [mixin]
stars-wrapper
Author
CDS
brand-emphasis
$brand-emphasis: color.get('action', 'selection-control', 'on', '02') !default;Description
Brand color applied to some components' various emphasis states
Type
Color
Author
CDS
border-color
$border-color: color.get('action', 'selection-control', 'off', 'primary') !default;Description
Unchecked default border color
Type
Color
Author
CDS
border-color-focus
$border-color-focus: $brand !default;Description
Border color when focused
Type
Color
Used by
- [mixin]
choice-control-custom - [mixin]
menu-group-link
Author
CDS
border-color-checked
$border-color-checked: $brand !default;Description
Border color when checked
Type
Color
Used by
- [mixin]
choice-control-custom - [mixin]
checkbox-control-custom
Author
CDS
border-width
$border-width: unit.rem(1px) !default;Description
Border width
Type
Number
Author
CDS
disabled-background-color
$disabled-background-color: color.get('ui-bg', '02') !default;outline-color
$outline-color: $brand !default;Description
Color of outline when focused
Type
Color
Used by
- [mixin]
choice-control-custom - [mixin]
icon
Author
CDS
size
$size: unit.rem(20px) !default;Description
Control size for width and height
Type
Number
Used by
- [mixin]
button-padding - [mixin]
generate-styles - [mixin]
icon-container - [mixin]
icon-size - [mixin]
icon-circle - [mixin]
generate-all-show-hide - [mixin]
show-on-size - [mixin]
hide-on-size - [function]
get-spacing - [mixin]
generate-spacing - [function]
get-columns - [function]
get-gutters - [function]
get-column-width - [function]
has-min-breakpoint - [function]
has-max-breakpoint - [mixin]
generate-container-spacing - [mixin]
generate-item-spacing - [mixin]
generate-item-span-width - [mixin]
generate-item-spans - [mixin]
generate-breakpoint-item-spans - [mixin]
generate-all-item-spans - [mixin]
generate-item-offset-margin - [mixin]
generate-item-offsets - [mixin]
generate-breakpoint-item-offsets - [mixin]
generate-all-item-offsets - [mixin]
generate-item-ordering - [mixin]
generate-breakpoint-item-ordering - [mixin]
generate-all-item-ordering - [mixin]
item-span - [mixin]
item-offset - [function]
get-next-breakpoint-size - [function]
get-breakpoint-min - [function]
get-breakpoint-max - [mixin]
query - [mixin]
generator-landscape-extended - [mixin]
favorite - [mixin]
star-svg-icon - [mixin]
text-skeleton - [mixin]
line - [mixin]
container - [function]
get-type-size
Author
CDS
width
$width: $size !default;Description
Custom width if different from $size
Type
Number
Used by
- [mixin]
choice-control-native - [mixin]
choice-control-custom - [mixin]
choice-append-container - [mixin]
item-span-width - [mixin]
item-offset-margin - [mixin]
append-container-indent - [mixin]
aspect-ratio - [mixin]
shape - [mixin]
root-container - [mixin]
content-arrow
Author
CDS
height
$height: $size !default;Description
Custom height if different from $size
Type
Number
Author
CDS
label-align
$label-align: flex-start !default;Description
Flexbox property to set vertical alignment between choice control and label
Type
String
Author
CDS
label-spacing
$label-spacing: spacing.get('s2') !default;Description
Spacing between choice control and label
Type
Number
Used by
- [mixin]
choice-label - [mixin]
choice-append-container - [mixin]
label - [mixin]
label - [mixin]
append-container-indent
Author
CDS
label-text-color
$label-text-color: inherit !default;Description
Label text color
Type
Color
Used by
- [mixin]
choice-label - [mixin]
field-control - [mixin]
field-label
Author
CDS
label-text-color-disabled
$label-text-color-disabled: color.get('text', 'tertiary') !default;