Package Exports
- @layerhub-io/react-eye-dropper
- @layerhub-io/react-eye-dropper/dist/index.js
- @layerhub-io/react-eye-dropper/dist/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@layerhub-io/react-eye-dropper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
React Eye Dropper
React Eye Dropper component for all browsers
Installation
pnpm install @layerhub-io/react-eye-dropper
Usage
Use as hook
import { useEyeDropper } from "@layerhub-io/react-eye-dropper";
function App() {
const { onInit, color } = useEyeDropper();
return (
<div style={{ backgrounColor: color }}>
<div onClick={onInit}>TRIGGER</div>
</div>
);
}
Use as component
import EyeDropper from "@layerhub-io/react-eye-dropper";
function App() {
const onChange = (c) => {
console.log({ c });
};
return (
<div style={{ backgrounColor: color }}>
<EyeDropper onChange={onChange}>
<div>TRIGGER</div>
</EyeDropper>
</div>
);
}