react-color#SwatchesPicker JavaScript Examples

The following examples show how to use react-color#SwatchesPicker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js    From ant-simple-pro with MIT License 6 votes vote down vote up
Index = memo(function Index() {

  const [color,setColor] = useState('#fff');

  const colorChange = (val) =>{
    setColor(val.hex)
  }

  return (
    <div style={{padding:'20px',background:color}}>
      <Row gutter={[20,20]}>
        <Col xs={24} sm={24} md={12} lg={12} xl={12}>
          <SketchPicker color={color} onChange ={colorChange} />
        </Col>
        <Col xs={24} sm={24} md={12} lg={12} xl={12}>
          <SwatchesPicker color={color} onChange ={colorChange} />
        </Col>
        <Col xs={24} sm={24} md={12} lg={12} xl={12}>
          <ChromePicker color={color} onChange ={colorChange} />
        </Col>
        <Col xs={24} sm={24} md={12} lg={12} xl={12}>
          <CompactPicker color={color} onChange ={colorChange} />
        </Col>
      </Row>
    </div>
  )
})