Skip to content

Color Palette

export function ColorPalette({
value,
options = DEFAULT_COLOR_PALETTE_OPTIONS,
ariaLabel,
defaultLabel,
colorAriaLabel,
disabled = false,
includeDefault = true,
defaultDisabled = false,
onChange,
}: ColorPaletteProps);

export function createColorPaletteMenuItems(options: {
/** `undefined` represents a mixed multi-selection with no checked choice. */
readonly value: ColorPaletteValue | undefined;
readonly options?: readonly ColorPaletteOption[];
readonly defaultLabel: string;
readonly colorAriaLabel: (option: ColorPaletteOption) => string;
readonly disabled?: boolean;
readonly includeDefault?: boolean;
readonly defaultDisabled?: boolean;
readonly onChange: (value: ColorPaletteValue) => void;
}): ContextMenuItem[];

interface ColorPaletteOption {
readonly value: string;
readonly label: string;
readonly disabled?: boolean
}

export type ColorPaletteValue = string | null;

interface ColorPaletteProps {
readonly value: ColorPaletteValue;
readonly options?: readonly ColorPaletteOption[];
readonly ariaLabel: string;
readonly defaultLabel: string;
readonly colorAriaLabel: (option: ColorPaletteOption) => string;
readonly disabled?: boolean;
readonly includeDefault?: boolean;
readonly defaultDisabled?: boolean;
readonly onChange: (value: ColorPaletteValue) => void
}

DEFAULT_COLOR_PALETTE_OPTIONS: readonly ColorPaletteOption[];