duiker101 / react-shadow-picker

A ReactJS picker for CSS shadows inspired by the Chromium devtools.

Home Page:https://react-shadow-picker.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm NPM

React Shadow Picker

A shadow picker inspired by the Chromium devtools

Example

Demo

Live Demo

Installation

yarn add react-shadow-picker

Usage

The component can be used either in a Controlled or Uncontrolled way. If you pass the value back to the component, it will be controlled.

import {ShadowPicker} from "react-shadow-picker";

const App = () => {
    const [shadow, setShadow] = useState("0px 0px 10px 10px #44444455");

    return (
        <div style={{boxShadow: shadow}}>
            <ShadowPicker
                value={shadow}
                onChange={(value) => {
                    setShadow(value);
                }}
            />
        </div>
    );
};

Styling

Assign the picker a custom class

<ShadowPicker className={"custom-picker"} ...
/>

and then style it with these classes

.custom-picker.shadow-picker {
    background: antiquewhite;
    color: blue;
}

.custom-picker .shadow-picker__position {
    border: 1px solid blue;
}

.custom-picker .shadow-picker__position.active {
    background: aquamarine;
}

.custom-picker .shadow-picker__grid {
    border: 1px solid blue;
}

.custom-picker .shadow-picker__grid-line {
    color: red;
}

.custom-picker .shadow-picker__grid-handle {
    color: red;
}

.custom-picker .shadow-picker__input {
    border: 1px solid teal;
}

.custom-picker .shadow-picker__slider {
    background: red;
}

.custom-picker .shadow-picker__slider::-webkit-slider-thumb {
    background: blue;
}

About

A ReactJS picker for CSS shadows inspired by the Chromium devtools.

https://react-shadow-picker.vercel.app

License:MIT License


Languages

Language:TypeScript 89.2%Language:CSS 7.0%Language:HTML 2.6%Language:JavaScript 1.2%