Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atomik-color/core

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atomik-color/core

Hooks (and component) for building accessible color picker for React. 0 dependecies, tiny ~3K, built-in powerful color conversions, touch and pen support, keyboard and screen-reader accessible, built using React hooks, fast!

  • 1.0.13
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Atomik Color

Hooks (and component) for building accessible color picker for React. 0 dependecies, tiny ~3K, built-in powerful color conversions, touch and pen support, keyboard and screen-reader accessible, built using React hooks, fast!

Demo

Installation

This examples shows how to install and use the color picker component, not the hooks! If you want to build your own color picker using our hooks see this example

yarn add @atomik-color/component

Usage

import ColorPicker from  "@atomik-color/component"

<ColorPicker />

// Default value
import { str2Color } from "@atomik-color/core"

<ColorPicker defaultValue={str2Color("#000")} />

// Controlled
import { useState } from  "react";
import { str2Color } from "@atomik-color/core"

const [color, setColor] = useState(str2Color("#000"))

<ColorPicker value={color} onChange={setColor} />

API

ColorPicker

Props

interface Props extends UseColorStateProps {
  showPreview?: boolean;
}
NameDescriptionTypeDefault
value?Present color valueTColor-
defaultValue?Default colorTColor-
onChange?Callback function for tracking the state change(value:TColor) => void-
showPreview?If true, preview box will be showntrue

useColorState

useColorState(props: UseColorStateProps): UseColorState

Props

NameDescriptionTypeDefault
value?Present color valueTColor-
defaultValue?Default colorTColor-
onChange?Callback function for tracking the state change(value:TColor) => void-

useColorRectangle

Props

NameDescriptionTypeDefault
stateColor stateColorState-
refRef of the element used as color rectangleRefObject<HTMLElement>-
ariaLabel?Aria labelstring-
ariaValueFormat?Formatted string used for aria-valuetextstring-
ariaDescription?Aria descriptionstring-

useHue

Props

NameDescriptionTypeDefault
stateColor stateColorState-
refRef of the element used as hue containerRefObject<HTMLElement>-

useAlpha

Props

NameDescriptionTypeDefault
stateColor stateColorState-
refRef of the element used as alpha containerRefObject<HTMLElement>-

FAQs

Package last updated on 11 Dec 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc