JGuang

Color Picker

Color Picker · Chakra UI

Preview
npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0

Color Picker

Used to select colors from a color area or a set of defined swatches

Respect native color parsing and formats, provide keyboard/text alternatives to dragging, and verify alpha previews rather than treating every string as a valid color.

Included icon notices

The source viewer includes ICON_ATTRIBUTION.md and original notices for the icon collections used by these examples. Preserve them when redistributing examples; react-icons' wrapper license does not replace individual collection terms.

  • Lucide: ISC

Installation and initialization

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0

Initialize ChakraProvider with defaultSystem and Emotion before rendering. Preserve the host React version and inspect peer compatibility. Official npm installation supplies components, not these example source files. Use the resource setup guide for locale, next-themes and framework-specific SSR; copy the selected example source separately from npm installation.

Complete native usage example

This is the actual pinned example, not a generic API mock. Copy its source closure and retain the named export. Additional imports are listed per example below.

"use client"

import { ColorPicker, HStack, Portal, parseColor } from "@chakra-ui/react"

export const ColorPickerBasic = () => {
  return (
    <ColorPicker.Root defaultValue={parseColor("#eb5e41")} maxW="200px">
      <ColorPicker.HiddenInput />
      <ColorPicker.Label>Color</ColorPicker.Label>
      <ColorPicker.Control>
        <ColorPicker.Input />
        <ColorPicker.Trigger />
      </ColorPicker.Control>
      <Portal>
        <ColorPicker.Positioner>
          <ColorPicker.Content>
            <ColorPicker.Area />
            <HStack>
              <ColorPicker.EyeDropper size="xs" variant="outline" />
              <ColorPicker.Sliders />
            </HStack>
          </ColorPicker.Content>
        </ColorPicker.Positioner>
      </Portal>
    </ColorPicker.Root>
  )
}

All examples and reproduction requirements

Names identify demos, not component variant props. Copy every sourceFiles entry for the selected example. The compositions alias denotes local files, not a package. Preserve relative imports or rewrite the alias to your project's actual path. React peers are inspected separately; editor examples retain the coherent pinned Tiptap extension family.

Basic

color-picker-basic · Named export ColorPickerBasic · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-basic.tsx

With Sizes

color-picker-with-sizes · Named export ColorPickerWithSizes · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/color-picker-with-sizes.tsx

With Variants

color-picker-with-variants · Named export ColorPickerWithVariants · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-with-variants.tsx

Input Only

color-picker-input-only · Named export ColorPickerInputOnly · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-input-only.tsx

Swatch Only

color-picker-swatch-only · Named export ColorPickerSwatchOnly · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-swatch-only.tsx

Trigger Only

color-picker-trigger-only · Named export ColorPickerTriggerOnly · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-trigger-only.tsx

Controlled

color-picker-controlled · Named export ColorPickerControlled · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-controlled.tsx

With Store

color-picker-with-store · Named export ColorPickerWithStore · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-with-store.tsx

Change End

color-picker-change-end · Named export ColorPickerChangeEnd · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-change-end.tsx

Channel Slider Only

color-picker-channel-slider-only · Named export ColorPickerChannelSliderOnly · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-channel-slider-only.tsx

With Hook Form

color-picker-with-hook-form · Named export ColorPickerWithHookForm · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-hook-form@7.77.0
  • vendor/apps/compositions/src/examples/color-picker-with-hook-form.tsx

Inline

color-picker-inline · Named export ColorPickerInline · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-inline.tsx

Open From Dialog

color-picker-open-from-dialog · Named export ColorPickerOpenFromDialog · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-open-from-dialog.tsx

With Disabled

color-picker-with-disabled · Named export ColorPickerWithDisabled · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-with-disabled.tsx

With Channel Input

color-picker-with-channel-input · Named export ColorPickerWithChannelInput · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-with-channel-input.tsx

With Fit Content

color-picker-with-fit-content · Named export ColorPickerWithFitContent · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/color-picker-with-fit-content.tsx

With Save Swatch

color-picker-with-save-swatch · Named export ColorPickerWithSaveSwatch · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/color-picker-with-save-swatch.tsx

With Swatches

color-picker-with-swatches · Named export ColorPickerWithSwatches · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/color-picker-with-swatches.tsx

With Swatch And Input

color-picker-with-swatch-and-input · Named export ColorPickerWithSwatchAndInput · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/color-picker-with-swatch-and-input.tsx

Native API and source references

The source viewer retains original declarations, imports and inheritance. Ark UI event contracts, Chakra style props and recipe types stay in their native packages; this guide does not flatten or invent their defaults. Code comments remain original source, not translated prose.

  • npm/@chakra-ui/react@3.37.0/dist/types/components/color-picker/color-picker.d.ts
  • npm/@chakra-ui/react@3.37.0/dist/types/components/color-picker/index.d.ts
  • npm/@chakra-ui/react@3.37.0/dist/types/components/color-picker/namespace.d.ts

State and installation checks

Run strict types, the target production build and real interactions. Test labels/focus/keyboard, both themes, narrow layout, empty/loading/error states where supported and cleanup after unmount. Remote demo endpoints, uploads and downloads are constrained in the preview; configure your own services. Copying a command or reaching preview-ready does not prove installation or backend success.

Provenance and license boundaries

https://github.com/chakra-ui/chakra-ui/tree/2e7517745cff2fcde0b8012f136cf99611ff262a

These are JGuang practical bilingual notes, not a full translation of upstream MDX. Original documentation and example bytes remain in vendor. Preserve repository MIT, compositions ISC metadata and separate dependency notices. The original metadata discrepancy and any missing full notices remain explicit review items; paid Chakra Pro is excluded.