NUIv3.0.7

Color Picker

A fully accessible, token-driven ColorPicker component built with strict WAI-ARIA compliance.

tsx
import { ColorPicker } from '@nofinite/nui';

Interactive Preview

Loading preview...

Usage

Basic Example

tsx
import { ColorPicker } from '@nofinite/nui';

<ColorPicker />

API Reference

PropTypeDefaultDescription
valuestring#000000The currently selected color in hex format
onChange((color: string) => void)Callback fired when a color is selected
presetsstring[][ '#000000', '#52525b', '#a1a1aa', '#ffffff', '#ef4444', '#f97316', '#f59e0b', '#84cc16', '#22c55e', '#14b8a6', '#06b6d4', '#3b82f6', '#6366f1', '#a855f7', '#d946ef', '#f43f5e', '#7f1d1d', '#7c2d12', '#78350f', '#3f6212', '#14532d', '#134e4a', '#164e63', '#1e3a8a', '#312e81', '#581c87', '#701a75' ]Array of hex colors to show in the preset grid
showCustombooleantrueWhether to show the native color picker input for custom colors
disabledbooleanfalseDisable the color picker
iconLucideIconCustom icon to display on the trigger button. Defaults to Palette.
variantenumdefaultVisual variant for the trigger button. 'default' is a form input, 'icon' is a compact toolbar button.
showTextbooleantrueShow the hex text in the default variant
showSwatchbooleantrueShow the color swatch circle in the default variant
showIconbooleantrueShow the palette icon in the default variant

Accessibility & Guidelines

  • Semantic Tokens: Built strictly using Nuicss semantic tokens (bg-surface, text-default, border-subtle, bg-primary).
  • Keyboard Navigation: Adheres to strict WAI-ARIA standards.
  • Screen Reader Support: Includes semantic roles and live regions where appropriate.