1.5.3 • Published 2 years ago

react-gradient-hook v1.5.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

License:MIT npm Downloads GitHub last commit Netlify Status GitHub stars

Examples

  • As a hook
const Component = (props) => {
  const [colors, gradient] = useGradient({options})
  ...
  return (
    { gradient }
  )
}
  • As a Component
const Component = (props) => {
  ...
  return (
    <Gradient {...options} />
  )
}

Props

NameTypeDefault ValueRequired?Description
defaultColorsTRGB[]see hereNoArray of default colors for the gradient
onChange(colors: TRGB[]) => voidundefinedNoFunction triggered when the gradient changes (different colors, a cursor is moved, ...)
gradientOptionsGradientOptionssee hereNoOptions to change the way the gradient is displayed
cursorOptionsCursorOptionssee hereNoOptions to control the behavior of the cursors (i.e. colors on the gradient)
pickerOptionsPickerOptionssee hereNoOptions to control the color pickers under the gradient

Types

TRGB

NameTypeRequired?Description
rnumberYesRed value
gnumberYesGreen value
bnumberYesBlue value
tnumberYesPosition on the gradient (from 0 to 1 included)

GradientOptions

NameTypeDefault ValueRequired?Description
heightnumber45YesGradient's height in pixels

CursorOptions

NameTypeDefault ValueRequired?Description
widthnumber15No-
bordernumber4No-
shadownumber2No-
scalenumber1No-
gridbooleanfalseNo-
samplesnumber20NoNumber of steps the cursors can take. Only works if grid is set to true

PickerOptions

NameTypeDefault ValueRequired?Description
showHuebooleantrueNo-
showChromebooleantrueNo-
showCirclesbooleantrueNo-
1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.16

2 years ago

1.4.15

2 years ago

1.4.14

2 years ago

1.4.13

2 years ago

1.4.12

2 years ago

1.4.10

2 years ago

1.4.9

2 years ago

1.4.8

2 years ago

1.4.7

2 years ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago