0.39.1 • Published 10 days ago

@cypress-design/vue-icon v0.39.1

Weekly downloads
-
License
MIT
Repository
-
Last release
10 days ago

Icon

Install

npm install @cypress-design/vue-icon

or with yarn

yarn add @cypress-design/vue-icon

Usage

import Icon from '@cypress-design/vue-icon'

Import

2 methods exist to load this component:

Use named imports of each icon you plan on using. I recommend this method because:

  • It's tree shakable: Only the icons you use will end up in your bundle
  • You get TS validation of color props: if a color is not available, squigles will appear in your editor
<script setup>
import { IconObjectBookCode } from '@cypress-design/vue-icon'
</script>

<template>
  <IconObjectBookCode />
</template>

Import the default Icon component and pass the name of the icon. It can be useful but you should avoid it in production unless you know what you are doing.

It has advantages:

  • Allows for quick browsing of the available icons right in the template
  • Allows passing ids around and delegating color and size until the implementation.

But drawbacks too:

  • it prevents tree shaking.
  • It uses TypeScript to check sizes and colors but with a twist:
    • If the size of the icon is not available for the icon selected and is available for another, the error will appear on the icon component instead of on the size prop.
<script setup>
import Icon from '@cypress-design/vue-icon'
</script>

<template>
  <Icon name="object-book-code" />
</template>

Colors

Should you need to change the color of the icon on hover or focus prefix the props with these words.

Here, the strokeColor will change on hover from indigo to jade

<script setup>
import { IconObjectBook } from '@cypress-design/vue-icon'
</script>

<template>
  <button class="flex items-center gap-[8px]">
    <IconObjectBook
      size="16"
      strokeColor="blue-600"
      hoverStrokeColor="jade-600"
    />Read
  </button>
</template>

If you need the hover or focus effect to be triggered on the parent group, use interactiveColorsOnGroup. This prop will change all the pseudo prefixes to be group focused instead of triggered by the icon itself.

To achieve the same goal, in WindiCSS, we would use group-hover: instead of hover:.

<script setup>
import { IconObjectBook } from '@cypress-design/vue-icon'
</script>

<template>
  <button class="group hover:text-jade-800 flex items-center gap-[8px]">
    <IconObjectBook
      size="16"
      strokeColor="blue-600"
      hoverStrokeColor="jade-600"
      interactiveColorsOnGroup
    />Read
  </button>
</template>
0.39.1

10 days ago

0.39.0

23 days ago

0.38.0

1 month ago

0.37.1

1 month ago

0.37.0

1 month ago

0.36.0

2 months ago

0.35.0

2 months ago

0.34.1

2 months ago

0.34.0

2 months ago

0.33.0

3 months ago

0.32.0

3 months ago

0.30.0

7 months ago

0.29.0

7 months ago

0.27.0

7 months ago

0.25.0

9 months ago

0.31.2

6 months ago

0.31.1

6 months ago

0.31.0

6 months ago

0.28.0

7 months ago

0.24.3

10 months ago

0.26.0

8 months ago

0.24.2

10 months ago

0.24.1

10 months ago

0.24.0

10 months ago

0.21.0

1 year ago

0.22.4

12 months ago

0.23.2

12 months ago

0.22.3

12 months ago

0.23.1

12 months ago

0.22.2

1 year ago

0.23.0

12 months ago

0.22.1

1 year ago

0.22.0

1 year ago

0.20.0

1 year ago

0.19.0

1 year ago

0.19.1

1 year ago

0.19.2

1 year ago

0.18.1

1 year ago

0.18.0

1 year ago

0.16.0

1 year ago

0.15.1

1 year ago

0.17.0

1 year ago

0.13.0

1 year ago

0.14.0

1 year ago

0.15.0

1 year ago

0.14.1

1 year ago

0.14.2

1 year ago

0.11.0

2 years ago

0.12.0

2 years ago

0.11.1

2 years ago

0.12.1

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.3.0

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.4.2

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago