-
Notifications
You must be signed in to change notification settings - Fork 8
ColorPaletteControl
Junaid Bhura edited this page Dec 8, 2020
·
3 revisions
import { ColorPaletteControl } = gumponents.components;
...
attributes: {
color: {
type: 'object',
},
},
...
<ColorPaletteControl
label="Choose a color"
value={ color ? color.color : null }
onChange={ ( color ) => setAttributes( { color } ) }
/>
The label for the control.
- Type:
String
- Required: No
The help text for the control.
- Type:
String
- Required: No
The selected hex color for this control.
- Type:
String
- Required: Yes
A function that receives the values of the control. The return value is an object that looks like:
{
color: '#ffffff',
slug: 'white',
}
- Type:
Function
- Required: Yes
Pass in custom colors. If this isn't passed, it defaults to the global custom colors.
- Type:
Array
- Required: No
Defaults to the global value. Pass in a boolean value to override this behavior.
- Type:
Boolean
- Required: No