Package Exports
- @dmitrychebayewski/material-ui-4-color
- @dmitrychebayewski/material-ui-4-color/esm/index.js
- @dmitrychebayewski/material-ui-4-color/index.js
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 (@dmitrychebayewski/material-ui-4-color) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
material-ui-color
picker and other components
Collections of color components for material-ui. No dependencies, small, highly customizable and theming support !
Contents
- Why rework Mikbry's project?
- Why another ColorPicker?
- Documentation
- Requirements
- Install
- Usage
- Roadmap
- Contribute
- License
Why rework Mikbry's project?
- Plans are submitting PR into his mui-color project, but I need enhanced Color Picker MUI 4 for a limited time;
- Allows passing useful properties to material-ui TextField underlying component;
- Stable version 1.2.0 codebase, Material UI V.4;
- ColorPicker adornment: Button, embedded in the underlying TextField (similarly to material-ui-pickers experience).
Why another ColorPicker ?
- Fully compatible with Material-UI : theming and low level components
- Highly customizable ColorPicker : gradient picker, palette, input format, deferred mode
- Small in size (<30kb) without any direct dependencies
- Use modern React hook and coding conventions
- Documentation made with Storybook, using Component Story Format and MDX
Documentation
Full documentation is available here :
https://mikbry.github.io/material-ui-color/
Examples
Also in codesanbox
Javascript : https://codesandbox.io/s/material-ui-color-qb4vm?file=/src/App.jsx
Typescript : https://codesandbox.io/s/material-ui-color-picker-qvcg3?file=/src/App.tsx
Requirements
- Works on modern browsers supporting ES6+ (Not compatible with IE)
- React and Material-UI frameworks
Install
yarn add @dmitrychebayewski/material-ui-4-color
Or using npm
npm install @dmitrychebayewski/material-ui-4-color
Usage
you need to have in your dependencies:
"@material-ui/core": "^4.11.2",
"material-ui-popup-state": "^1.7.1",
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
material-ui-color
bring 5 components.
<ColorPicker/>
A popover component to display a color tool box. It uses ColorBox
and material-ui-popup-state
.
import { ColorPicker } from 'material-ui-color';
export const Container = () => (
<div>
<ColorPicker defaultValue="transparent"/>
</div>
);
<ColorBox />
A component to display a color tool box
import { ColorBox } from 'material-ui-color';
export const Container = () => (
<div>
<ColorBox defaultValue="transparent"/>
</div>
);
<ColorInput />
An input component to display/edit color values in different format (plain, hex, rgb, hsl, hsv).
import { ColorInput } from 'material-ui-color';
export const Container = () => (
<div>
<ColorInput defaultValue="red"/>
</div>
);
<ColorPalette />
A component to display a grid of color buckets.
import { ColorPalette } from '@dmitrychebayewski/material-ui-4-color';
const palette = {
red: '#ff0000',
blue: '#0000ff',
green: '#00ff00',
yellow: 'yellow',
cyan: 'cyan',
lime: 'lime',
gray: 'gray',
orange: 'orange',
purple: 'purple',
black: 'black',
white: 'white',
pink: 'pink',
darkblue: 'darkblue',
};
export const Container = () => (
<div>
<ColorPalette palette={palette} />
</div>
);
<ColorButton />
Displays a button filled with a color
import { ColorButton } from 'material-ui-color';
export const Container = () => (
<div>
<ColorButton color="red"/>
</div>
);
Roadmap
v1.2.5 - Current version
- More Picker Button adornments
- Submit a PR to Mikbry's mui-color
- Make @dmitrychebayewski/material-ui-4-color deprecated
Contribute
Contributions welcome! Read the contribution guidelines first.
License
Released under MIT License