Removing Opacity Inputs

The ColorGradient provides options for the user to specify whether an alpha slider and an alpha input will be rendered.

The following example demonstrates how to remove the opacity-related fields.

class App extends React.Component {
    state = { value: 'rgba(195, 0, 47, 1)' };

    render() {
        return (
            <div>
                <div className="example-config">
                    <strong>Selected color: <span>{ this.state.value }</span></strong>
                </div>
                <ColorGradient opacity={false} defaultValue={this.state.value} onChange={this.onChange} />
            </div>
        );
    }

    onChange = event => this.setState({ value: event.value });
}

ReactDOM.render(
    <App />,
    document.querySelector('my-app')
);
In this article
 /