🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

@uiw/react-color-sketch

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-color-sketch

Color Sketch component for React.

latest
Source
npmnpm
Version
2.9.2
Version published
Weekly downloads
99K
-5.41%
Maintainers
2
Weekly downloads
 
Created
Source
Using my app is also a way to support me:
Vidwall Hub VidCrop Vidwall Mousio Hint Mousio Musicer Audioer FileSentinel FocusCursor Videoer KeyClicker DayBar Iconed Mousio Quick RSS Quick RSS Web Serve Copybook Generator DevTutor for SwiftUI RegexMate Time Passage Iconize Folder Textsound Saver Create Custom Symbols DevHub Resume Revise Palette Genius Symbol Scribe

React Color Sketch

Buy me a coffee npm bundle size npm version Open in unpkg

Sketch Component is a subcomponent of @react-color.

react-color-sketch

Install

npm i @uiw/react-color-sketch

Usage

import React, { useState } from 'react';
import Sketch from '@uiw/react-color-sketch';

function Demo() {
  const [hsva, setHsva] = useState({ h: 214, s: 43, v: 90, a: 1 });
  const [disableAlpha, setDisableAlpha] = useState(false);
  return (
    <div>
      <div style={{ display: 'flex' }}>
        <Sketch
          style={{ marginLeft: 20 }}
          color={hsva}
          disableAlpha={disableAlpha}
          onChange={(color) => {
            setHsva(color.hsva);
          }}
        />
        <Sketch
          style={{ marginLeft: 20 }}
          color={hsva}
          disableAlpha={disableAlpha}
          onChange={(color) => {
            setHsva(color.hsva);
          }}
        />
      </div>
      <button onClick={() => setDisableAlpha(!disableAlpha)}>
        disableAlpha={disableAlpha.toString()}
      </button>
    </div>
  );
}

export default Demo;

Set presetColors Example

import React, { useState } from 'react';
import Sketch from '@uiw/react-color-sketch';

const PRESET_COLORS = [
  '#D0021B',
  '#F5A623',
  '#f8e61b',
  '#8B572A',
  '#7ED321',
  '#417505',
  '#BD10E0',
  '#9013FE',
];

function Demo() {
  const [hex, setHex] = useState("#fff");
  const [disableAlpha, setDisableAlpha] = useState(false);
  return (
    <div>
      <Sketch
        style={{ marginLeft: 20 }}
        color={hex}
        disableAlpha={disableAlpha}
        presetColors={PRESET_COLORS}
        onChange={(color) => {
          setHex(color.hex);
        }}
      />
      <button onClick={() => setDisableAlpha(!disableAlpha)}>
        disableAlpha={disableAlpha.toString()}
      </button>
    </div>
  );
}

export default Demo;

Props

import React from 'react';
import { HsvaColor, ColorResult } from '@uiw/color-convert';
import { SwatchPresetColor } from '@uiw/react-color-swatch';
export interface SketchProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'color'> {
  prefixCls?: string;
  width?: number;
  color?: string | HsvaColor;
  presetColors?: false | SwatchPresetColor[];
  editableDisable?: boolean;
  disableAlpha?: boolean;
  onChange?: (newShade: ColorResult) => void;
}
declare const Sketch: React.ForwardRefExoticComponent<SketchProps & React.RefAttributes<HTMLDivElement>>;
export default Sketch;

Contributors

As always, thanks to our amazing contributors!

Made with contributors.

License

Licensed under the MIT License.

Keywords

react

FAQs

Package last updated on 28 Oct 2025

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