Cal.comdesign-system

Color Picker

Brand and appearance hex color control with swatch, input, and optional reset.

Cross-domain brand color control used on user, team, org, embed, event-type, and onboarding appearance surfaces.

Ownership

Feature — not @coss/ui/shared. Lives under packages/features/components because it depends on @calcom/i18n, brand hex helpers (isValidHexCode / fallBackHex from @calcom/lib/getBrandColours), and react-colorful. Reuse the Feature import; do not relocate for docs.

Use when

  • A Cal surface edits a persisted brand or appearance hex color.
  • The user needs the standard swatch popover, hex input, and optional reset action.
  • The caller owns validation and persistence; ColorPicker only reports text changes.

Do not compose another picker from react-colorful in product code. Import this Feature control instead. For a generic color primitive outside Cal product UI, confirm that this product contract is not required.

Canonical usage

The appearance settings page owns WCAG validation and React Hook Form dirty state around the shared control:

apps/web/modules/settings/my-account/appearance-view.tsx

This matches production: ColorPicker is uncontrolled and seeded with defaultValue, so the Controller render ignores field and writes through formMethods.setValue(..., { shouldDirty: true }). Do not invent a controlled value={field.value} wiring unless the product call site does.

Read the complete call site before copying it: validation background differs between light and dark brand colors, and embed usage passes a container for the popover portal.

API

Call sites

Example URLs

Not exhaustive — a few places you can open locally (e.g. http://localhost:3000) to see this in product.

Source

packages/features/components/color-picker/index.tsx