New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-chevron

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-chevron

The chevron component that works as inline character in React

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

title.png

About

No more '>' in your button, no more complicated image customization.

Insert chevron image that perfectly fits with sibling text by the super-light library, which doesn't have any peer dependencies.

  • Korean README is available 😉

Installation

$ yarn add react-chervron

The React-chevron supports TypeScript.

Usage

Default

basic

import Chevron from 'react-chevron'

...

const myComponent = (...) => {
  ...
  
  return (
    <div>
    	More Info <Chevron/>
    </div>
  )
}

Import and use. That's it!

Size & Color

size.png

color

import Chevron from 'react-chevron'

...

const myComponent = (...) => {
  ...
  
  return (
    <>
      <div style={ { 'fontSize': '24px' } }>
        More Info <Chevron/>
      </div>
      <div style={ { 'color': '#bb0000' } }>
        More Info <Chevron/>
      </div>
    </>
  )
}

As explained above, you don't have to customize chevron size. It will be automatically fit with sibling text.

*Inline styles are for the convenience of creating examples. You may use a CSS file or a Styled Component at all.

Direction

direction

import Chevron from 'react-chevron'

...

const myComponent = (...) => {
  ...

  return (
    <>
      <div>
        Four directions available
        <Chevron/>
        <Chevron direction={'right'}/>
        <Chevron direction={'down'}/>
        <Chevron direction={'up'}/>
        <Chevron direction={'left'}/>
      </div>
    </>
  )
}


Four direction options are available. The default direction is 'right'.

className

tilt.png

import Chevron from 'react-chevron'
import 'myStyle.css'

...

const myComponent = (...) => {
  ...
  
  return (
    <div>
    	More Info <Chevron className="tilt"/>
    </div>
  )
}
/* myStyle.css */
.tilt svg {
  transform: rotate(30deg);
}

As same as other react components, you can pass className as props.

⚠️ Be aware the <span> that wrapping svg exists.

Rotate animation

rotate.gif

import Chevron from 'react-chevron'
import 'myStyle.css'

...

const myComponent = (...) => {
  ...
  
  const [ reversed, setReversed ] = useState<boolean>(false)
  return (
     <div onClick={() => setReversed(!reversed) }>
       More Info <Chevron reversed={ reversed }/>
     </div>
  )
}

You can toggle direction as opposed by toggle status.

Open License 😎

You can use it for commercial, non-commercial either without any charge.

Also, there is no need to specify the author's name separately.

Author: blueStragglr (Oortcloud1599@gmail.com) [https://bluestragglr.com]

Keywords

Chevron

FAQs

Package last updated on 06 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts