Color Picker

General


Show Code
import React from "react";
import ColorPicker from 'funda-ui/ColorPicker';
 
// component styles
import 'funda-ui/ColorPicker/index.css';
 
export default () => {
 
    function handleChange(e) {
         console.log(e.target.value);
    }
 
    return (
        <>
            <ColorPicker
                clearBtnLabel="clear"
                name="name"
                shape="circle"
                onChange={handleChange}
            />
 
 
 
        </>
    );
}

No spacing

Show Code
import React from "react";
import ColorPicker from 'funda-ui/ColorPicker';
 
// component styles
import 'funda-ui/ColorPicker/index.css';
 
export default () => {
 
 
    return (
        <>
 
            <ColorPicker
                ...
                wrapperClassName="position-relative"
                ...
            />
 
             <ColorPicker
                ...
                wrapperClassName=""
                ...
            />
 
        </>
    );
}

Asynchronous Usage


Show Code
import React, { useEffect, useState } from "react";
import ColorPicker from 'funda-ui/ColorPicker';
 
 
// component styles
import 'funda-ui/ColorPicker/index.css';
 
export default () => {
 
    const [inputValue, setInputValue] = useState('');
 
    useEffect(() => {
       setInputValue('#ff6600');
    }, []);
 
 
    return (
        <>
            <ColorPicker
                clearBtnLabel={'Clear'}
                shape="circle"
                value={inputValue}
                name="name"
                onChange={(e) => {
                    setInputValue(e.target.value);
                }}
            />
 
        </>
    );
}

API

Color Picker

import ColorPicker from 'funda-ui/ColorPicker';
PropertyTypeDefaultDescriptionRequired
refReact.ForwardedRef-It is the return element of this component.-
wrapperClassNamestringmb-3 position-relativeThe class name of the control wrapper.-
controlClassNamestringform-control custom-form-control-color flex-grow-0The class name of the control.-
clearBtnClassNamestringbtn btn-link btn-smThe class name of the clear button.-
clearBtnLabelstringclearThe label of the clear button.-
valuestring-Set a default value for this control-
requiredLabelstring | ReactNode<span className="position-absolute end-0 top-0 my-2 mx-2"><span className="text-danger">*</span></span>It is used to specify a label for an element required.-
labelstring | ReactNode-It is used to specify a label for an element of a form.
Support html tags
-
namestring-Name is not deprecated when used with form fields.-
shapestringcircle | roundedSet shape of this control.-
disabledbooleanfalseWhether it is disabled-
requiredbooleanfalseWhen present, it specifies that a field must be filled out before submitting the form.-
onChangefunction-Call a function when the value of an HTML element is changed. It returns only one callback value which is the Control Event (Event)-
onBlurfunction-Call a function when a user leaves an form field. It returns only one callback value which is the Control Event (Event)-
onFocusfunction-Call a function when an form field gets focus. It returns only one callback value which is the Control Event (Event)-
onClearfunction-Clicking the empty button is triggered. It returns only one callback value which is the Control Event (Event)-

It accepts all props which this control support. Such as style, data-*, tabIndex, id, and so on.