File size: 740 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
---
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';
```
|