|
Download react-color/docs/documentation/02.02-include.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 740 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-color/docs/documentation/02.02-include.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-color/docs/documentation/02.02-include.md
-
curl -L -o 02.02-include.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-color/docs/documentation/02.02-include.md
740 Bytes
metadata
id: usage-include
title: Include Component
Import a color picker from react-color at the top of a component and then use it in the render function:
import React from 'react';
import { SketchPicker } from 'react-color';
class Component extends React.Component {
render() {
return <SketchPicker />;
}
}
You can import AlphaPicker BlockPicker ChromePicker CirclePicker CompactPicker GithubPicker HuePicker MaterialPicker PhotoshopPicker SketchPicker SliderPicker SwatchesPicker TwitterPicker respectively.
You can also import a picker individually to optimize your bundle size.
import SketchPicker from 'react-color/lib/Sketch';
import ChromePicker from 'react-color/lib/Chrome';