0.38.1 • Published 10 days ago

@cypress-design/react-icon v0.38.1

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

Icon

Install

npm install @cypress-design/react-icon

or with yarn

yarn add @cypress-design/react-icon

Usage

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

The simple way using the Icon component

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

export const MyButtonWithIcon = () => {
  return (
    <button className="flex items-center gap-[8px] p-[8px] border-1 border-red-500">
      <Icon
        name="object-book"
        size="16"
        strokeColor="blue-600"
        fillColor="red-200"
        className="bg-red-100"
      />
      Read
    </button>
  )
}

We can also import each icon components separately. When we use named imports, the results becomes tree-shakable (more optimized). This means that the final bundle will not contain any of the unused icons code. Only imported icons will end up in your app or website js.

import { IconObjectBook } from '@cypress-design/react-icon'

export const MyButtonWithIcon = () => {
  return (
    <IconObjectBook size="16" strokeColor="indigo-600" fillColor="red-200" />
  )
}

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

import { IconObjectBook } from '@cypress-design/react-icon'

export const MyButtonWithIcon = () => {
  return (
    <button>
      <IconObjectBook
        size="16"
        strokeColor="indigo-600"
        hoverStrokeColor="jade-600"
      />
    </button>
  )
}

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

import { IconObjectBook } from '@cypress-design/react-icon'

export const MyButtonWithIcon = () => {
  return (
    <button className="flex items-center gap-[8px] group hover:text-jade-800">
      <IconObjectBook
        size="48"
        strokeColor="indigo-600"
        hoverStrokeColor="jade-600"
        interactiveColorsOnGroup
      />
      Book
    </button>
  )
}
0.38.1

10 days ago

0.38.0

23 days ago

0.37.0

1 month ago

0.36.1

1 month ago

0.36.0

1 month ago

0.35.0

2 months ago

0.34.0

2 months ago

0.33.1

2 months ago

0.33.0

2 months ago

0.32.0

3 months ago

0.31.0

3 months ago

0.30.1

6 months ago

0.30.0

6 months ago

0.29.0

7 months ago

0.27.0

7 months ago

0.25.0

8 months ago

0.23.1

10 months ago

0.23.0

10 months ago

0.28.0

7 months ago

0.26.0

7 months ago

0.24.0

9 months ago

0.21.0

1 year ago

0.20.0

1 year ago

0.21.4

12 months ago

0.22.2

12 months ago

0.21.3

12 months ago

0.22.1

12 months ago

0.21.2

1 year ago

0.22.0

12 months ago

0.21.1

1 year ago

0.19.0

1 year ago

0.18.1

1 year ago

0.17.2

1 year ago

0.18.2

1 year ago

0.18.0

1 year ago

0.17.1

1 year ago

0.17.0

1 year ago

0.15.0

1 year ago

0.14.1

1 year ago

0.16.0

1 year ago

0.12.0

1 year ago

0.13.0

1 year ago

0.14.0

1 year ago

0.13.1

1 year ago

0.13.2

1 year ago

0.10.0

2 years ago

0.11.0

2 years ago

0.10.1

2 years ago

0.11.1

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

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.2

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago