
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
@workday/canvas-kit-react-color-picker
Advanced tools
Color Picker is a two part component. It has a color input that handles custom hex colors and then selecting specific swatches.
yarn add @workday/canvas-kit-react-color-picker
or
yarn add @workday/canvas-kit-color-picker
A controlled input for accepting typed/pasted hex codes.
import * as React from 'react';
import {ColorInput} from '@workday/canvas-kit-color-picker';
<ColorInput
showCheck={true}
onChange={this.onChange}
value={this.state.color}
onValidColorChange={this.validColorChange}
/>;
None
All props available for TextInput are available here. Also, all standard input attributes are
available and can be passed to the input field.
None
value: stringThe value entered by the user into the color input
inputRef: React.Ref<HTMLInputElement>A ref to the input element. This allows you to imperatively focus on the color input if needed.
onChange: (e: React.ChangeEvent<HTMLInputElement>) => voidA onChange callback from the input. Value can be accessed from
e.currentTarget.value. Should be used to control the input.
onValidColorChange: (color: string) => voidA callback that passes up the valid hex value typed by the user. This is always prefixed with a hash, and is always the expanded hex value (e.g. "03F" > "#0033FF").
showCheck: booleanOptionally show a check icon when a custom hex color has been selected
Default: false
error: ErrorTypeThe type of error to display, if any.
| Type | Description |
|---|---|
| Error | Red outline with error icon. |
| Alert | Yellow outline with alert icon. |
A component to show a color swatch
import * as React from 'react';
import {ColorPreview} from '@workday/canvas-kit-color-preview';
<ColorPreview value="#00FFCC" />;
None
value: stringThe value entered by the user into the color input
id: stringAn id linked to the color preview input to be used with an associated form label
FAQs
A Canvas-styled color picker
We found that @workday/canvas-kit-react-color-picker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

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.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.