Skip to main content

Figma Storybook

Colour Picker

Allows users to select or specify a colour via a visual picker or hex input. Use in configuration panels where a colour value is a required user input. Don't use when colours should be constrained to a token-defined palette.

Figma Storybook Docs

Description

What it does

Lets users select a colour through a visual hue/saturation canvas, a hue slider, an opacity slider, and a hex code input field. The selected colour value is returned as a hex string.

Where it appears

Appears in admin configuration panels — for example, when setting a project brand colour, customising a map layer colour, or configuring a chart series colour in a consultation report.

Why it exists

Some configuration workflows require a freeform colour value that cannot be constrained to a predefined palette. The colour picker gives users a controlled, accessible mechanism for specifying arbitrary colours without requiring them to know hex codes.

Dependencies

Input, Label, Popover

Anatomy

PartRequired?Notes
Trigger swatch Required A small filled square showing the currently selected colour. Clicking it opens the picker popover. Size is 24x24px with --op-radius-sm border-radius.
Hex input field Required A text input pre-populated with the current hex value (e.g. #3D9970). Allows direct keyboard entry of a hex code. Validates on blur.
Colour canvas Required A 2D saturation/lightness gradient canvas derived from the current hue. Users drag a circular thumb to set saturation and lightness.
Hue slider Required A horizontal rainbow gradient slider for selecting the base hue (0–360°). Rendered as a range input with custom styling.
Opacity slider Optional A horizontal checkerboard-backed slider for setting alpha (0–100%). Only shown when the consuming context requires alpha support.
Preset swatches row Optional A row of up to 8 clickable colour swatches representing recently used or context-recommended colours.
Popover container Required The floating panel that wraps all interactive picker elements. Positioned below the trigger swatch by default, flipping above when viewport space is limited.
Label Recommended A visible text label associated with the trigger via aria-labelledby. Describes what the colour is being applied to (e.g. 'Project brand colour').

Variants

Hex only

A compact inline input showing only the hex field and trigger swatch, with no popover canvas.

When the user is expected to know the exact colour value (e.g. entering a brand hex code from a style guide).

Full picker

The complete popover with canvas, hue slider, hex input, and optional opacity slider.

When users need to explore and select a colour freely, such as customising a map overlay or chart series.

Full picker with presets

Full picker with an additional row of preset swatches drawn from recently used or context-recommended colours.

When the configuration panel has an established set of common choices (e.g. standard map layer colours for a council).

States

State Behaviour
Default Trigger swatch displays the current colour. Hex input shows the corresponding hex value. Popover is closed.
Open Popover is visible. Focus moves to the colour canvas on open. Hex input and sliders are interactive.
Focused (trigger) Trigger swatch shows a 3px focus ring using --op-color-interactive-focus. Press Enter or Space to open the popover.
Focused (hex input) Hex input shows standard focus ring. User can type a valid hex code. Canvas and sliders update live on valid input.
Invalid If the hex input value is not a valid colour on blur, the input border switches to --op-color-status-error and an inline error message appears below the field.
Disabled Trigger swatch and hex input are non-interactive. Swatch has 40% opacity. Popover cannot be opened. aria-disabled='true' on the trigger.
Read-only The selected colour is displayed but cannot be changed. Trigger swatch is not focusable. Hex input has readonly attribute.

Usage guidelines

When to use

  • When a configuration field requires a freeform colour value that cannot be limited to a fixed palette — for example, a project brand colour in Open Point's project settings.
  • When setting the display colour of a map layer, chart series, or category legend item in a consultation report.
  • When an admin needs to match an exact organisational brand colour by entering a known hex code.

When not to use

  • When the valid colour options are limited to the Orbit token palette — use a token swatch selector or a select component instead to prevent off-brand choices.
  • When colour is used purely as a status indicator — use status tokens (--op-color-status-*) and the Badge or Tag component instead.
  • In public-facing Social Point forms — colour choice is an admin configuration concern, not a community input. Avoid exposing this component to end users.
  • When the colour must meet a specific contrast ratio against a known background — the colour picker does not validate WCAG contrast. Validate programmatically and surface a warning if the chosen colour fails.

Do / Don't

Do

Always pair the colour picker with a descriptive label (e.g. 'Marker colour') so users understand what the colour applies to.

Don't

Don't use the trigger swatch alone without a label — icon-only or swatch-only controls are not self-explanatory for all users.

Do

Show a preview of the colour applied in context (e.g. a sample map pin or chart bar) near the picker when possible.

Don't

Don't rely on the swatch alone to communicate colour impact — users may not be able to visualise how the colour will look in the actual UI.

Do

Validate the hex input on blur and surface a clear error message if the value is invalid (e.g. 'Enter a valid hex code, such as #3D9970').

Don't

Don't silently reset to the previous value on invalid input without notifying the user.

Do

Persist the selected value immediately on close so the swatch reflects the user's last confirmed choice.

Don't

Don't require a separate 'Apply' button inside the popover — this adds unnecessary steps for an already-deliberate interaction.

Was this page helpful?

Updated 9 September 2026