Introducing PrimeReact v11-alpha 🎉Discover Now

InputColor

An unstyled, accessible color picker component with compound composition.

Build fully custom color pickers with complete control over area, sliders, swatch, and input rendering.

basic-demo

Pre-styled Versions

Choose a pre-styled library to use InputColor with ready-made designs.
For hook-based usage without components, see the Headless API.

Features#

  • Compound component API with twelve sub-components: Root, Area, AreaBackground, AreaThumb, Slider, SliderTrack, SliderThumb, Swatch, SwatchBackground, EyeDropper, Input, TransparencyGrid
  • 2D color gradient area with pointer capture for smooth picking
  • Channel-based sliders for hue, alpha, and other color channels
  • Multiple color formats: HSBA, HSLA, RGBA, OKLCHA
  • Native EyeDropper API integration

Usage#

import { InputColor } from 'primereact/inputcolor';
<InputColor.Root>
    <InputColor.Area>
        <InputColor.AreaBackground />
        <InputColor.AreaThumb />
    </InputColor.Area>
    <InputColor.Slider>
        <InputColor.TransparencyGrid />
        <InputColor.SliderTrack />
        <InputColor.SliderThumb />
    </InputColor.Slider>
    <InputColor.Swatch>
        <InputColor.TransparencyGrid />
        <InputColor.SwatchBackground />
    </InputColor.Swatch>
    <InputColor.EyeDropper></InputColor.EyeDropper>
    <InputColor.Input />
</InputColor.Root>

Behavior#

Polymorphic Rendering#

Use as on any sub-component to change the rendered HTML element.

<InputColor.Root as="section">
    <InputColor.Area as="div">
        <InputColor.AreaBackground as="div" />
        <InputColor.AreaThumb as="div" />
    </InputColor.Area>
    <InputColor.EyeDropper as="a" />
</InputColor.Root>

Default elements: Root=div, Area=div, AreaBackground=div, AreaThumb=div, Slider=SliderRoot, SliderTrack=SliderTrack, SliderThumb=SliderThumb, Swatch=div, SwatchBackground=div, EyeDropper=button, Input=InputText, TransparencyGrid=div.

Render Function Children#

Sub-components accept a render function as children, providing access to the component instance. The instance exposes inputColor (root instance with state.value and state.isAreaDragging).

<InputColor.Swatch>{(instance) => <span>{instance.inputColor?.state.value.toString('hex')}</span>}</InputColor.Swatch>

Pass Through#

Some parts may not be visible in the preview depending on the component's current state.

Loading...
/* Select a part to see its CSS selector for custom styling */

API#

InputColorRoot#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorRootInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorRootInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorRootInstance—
The instance to pass to the component.
ptSafeRecord<InputColorRootPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorRootInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
valueColorInstance—
The value of the color picker.
defaultValueColorInstance—
The default value of the color picker.
formatColorSpace—
The format of the color picker.
disabledboolean—
Whether the color picker is disabled.
onValueChange(event: useInputColorChangeEvent) => void—
Callback fired when the color picker's value is changed.
onValueChangeEnd(event: useInputColorChangeEvent) => void—
Callback fired when the pointer interaction ends.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputcolor"
data-part"root"
data-disabledPresent when disabled
data-draggingPresent when area is dragged

Defines passthrough(pt) options of InputColor component.

labeltypedescription
rootInputColorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
areaInputColorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the area's DOM element.
areaBackgroundInputColorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the area background's DOM element.
areaThumbInputColorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the area thumb's DOM element.
inputInputColorRootPassThroughType<HTMLAttributes<HTMLInputElement>>Used to pass attributes to the input's DOM element.
sliderInputColorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the slider's DOM element.
sliderTrackInputColorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the slider track's DOM element.
sliderThumbInputColorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the slider thumb's DOM element.
swatchInputColorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the swatch's DOM element.
swatchBackgroundInputColorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the swatch background's DOM element.
eyeDropperInputColorRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the eye dropper's DOM element.
transparencyGridInputColorRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the transparency grid's DOM element.

InputColorArea#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorAreaInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorAreaInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorAreaInstance—
The instance to pass to the component.
ptSafeRecord<InputColorAreaPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorAreaInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputcolor"
data-part"area"

CSS Custom Properties

The Area element sets CSS custom properties on its style for gradient rendering and thumb positioning.

CSS VariableDescription
--area-backgroundSolid hue background of the area
--area-gradientCombined saturation/brightness gradient overlay
--thumb-backgroundCurrent color for the area thumb
--thumb-position-topVertical position of the area thumb
--thumb-position-leftHorizontal position of the area thumb

Defines passthrough(pt) options of InputColorArea component.

labeltypedescription
rootInputColorAreaPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputColorAreaBackground#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorAreaBackgroundInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorAreaBackgroundInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorAreaBackgroundInstance—
The instance to pass to the component.
ptSafeRecord<InputColorAreaBackgroundPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorAreaBackgroundInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputColorAreaBackground component.

labeltypedescription
rootInputColorAreaBackgroundPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputColorAreaThumb#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorAreaThumbInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorAreaThumbInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorAreaThumbInstance—
The instance to pass to the component.
ptSafeRecord<InputColorAreaThumbPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorAreaThumbInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputcolor"
data-part"area-thumb"

Defines passthrough(pt) options of InputColorAreaThumb component.

labeltypedescription
rootInputColorAreaThumbPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputColorSlider#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorSliderInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorSliderInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorSliderInstance—
The instance to pass to the component.
ptSafeRecord<InputColorSliderPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorSliderInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
channelColorSliderChannel—
The channel of the slider.
orientation"horizontal" | "vertical"—
The orientation of the slider.
disabledboolean—
Whether the slider is disabled.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputcolor"
data-part"slider"
data-orientation"horizontal" or "vertical"
data-channelThe slider channel name

CSS Custom Properties

The Slider element sets CSS custom properties on its style for track and thumb rendering.

CSS VariableDescription
--slider-backgroundChannel gradient for the slider track
--slider-thumb-backgroundCurrent channel color for the thumb

Defines passthrough(pt) options of InputColorSlider component.

labeltypedescription
rootInputColorSliderPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputColorSliderTrack#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorSliderTrackInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorSliderTrackInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorSliderTrackInstance—
The instance to pass to the component.
ptSafeRecord<InputColorSliderTrackPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorSliderTrackInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputColorSliderTrack component.

labeltypedescription
rootInputColorSliderTrackPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputColorSliderThumb#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorSliderThumbInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorSliderThumbInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorSliderThumbInstance—
The instance to pass to the component.
ptSafeRecord<InputColorSliderThumbPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorSliderThumbInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputcolor"
data-part"slider-thumb"

Defines passthrough(pt) options of InputColorSliderThumb component.

labeltypedescription
rootInputColorSliderThumbPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputColorSwatch#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorSwatchInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorSwatchInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorSwatchInstance—
The instance to pass to the component.
ptSafeRecord<InputColorSwatchPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorSwatchInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputcolor"
data-part"swatch"

CSS Custom Properties

The Swatch element sets a CSS custom property on its style for color rendering.

CSS VariableDescription
--swatch-backgroundCurrent color for the swatch

Defines passthrough(pt) options of InputColorSwatch component.

labeltypedescription
rootInputColorSwatchPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputColorSwatchBackground#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorSwatchBackgroundInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorSwatchBackgroundInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorSwatchBackgroundInstance—
The instance to pass to the component.
ptSafeRecord<InputColorSwatchBackgroundPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorSwatchBackgroundInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputColorSwatchBackground component.

labeltypedescription
rootInputColorSwatchBackgroundPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputColorEyeDropper#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorEyeDropperInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorEyeDropperInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorEyeDropperInstance—
The instance to pass to the component.
ptSafeRecord<InputColorEyeDropperPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorEyeDropperInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputcolor"
data-part"eye-dropper"

Defines passthrough(pt) options of InputColorEyeDropper component.

labeltypedescription
rootInputColorEyeDropperPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputColorInput#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorInputInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorInputInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorInputInstance—
The instance to pass to the component.
ptSafeRecord<InputColorInputPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorInputInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
channelColorInputChannel—
The channel of the input.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputcolor"
data-part"input"
data-channelThe input channel name

Defines passthrough(pt) options of InputColorInput component.

labeltypedescription
rootInputColorInputPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputColorTransparencyGrid#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputColorTransparencyGridInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: InputColorTransparencyGridInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputColorTransparencyGridInstance—
The instance to pass to the component.
ptSafeRecord<InputColorTransparencyGridPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: InputColorTransparencyGridInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputColorTransparencyGrid component.

labeltypedescription
rootInputColorTransparencyGridPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

Accessibility#

InputColorArea#

Screen Reader#

The area thumb has role="slider" with aria-roledescription="2d slider". It includes aria-label describing the two axes (e.g., "saturation and brightness"), aria-valuemin, aria-valuemax, aria-valuenow, and aria-valuetext describing the current channel values.

Keyboard Support#

KeyFunction
tabMoves focus to the area thumb.
right arrowMoves the area thumb to the right.
left arrowMoves the area thumb to the left.
up arrowMoves the area thumb up.
down arrowMoves the area thumb down.

InputColorSlider#

Screen Reader#

The slider thumb has role="slider" with aria-label, aria-valuemin, aria-valuemax, aria-valuenow, and aria-valuetext describing the current channel value.

Keyboard Support#

KeyFunction
tabMoves focus to the slider thumb.
up arrow || left arrowDecrements the slider value.
down arrow || right arrowIncrements the slider value.