ColorPalette
Description
A grid of named colour swatches
ColorPalette displays a set of named swatches for picking from a predefined brand or theme palette. It's distinct from the raw ColorPicker which allows any colour — use ColorPalette when the set of valid choices is known in advance.
API reference
public sealed class ColorPalette : ComponentBase<ColorPalette, HTMLElement>A grid of named colour swatches for letting users pick from a predefined palette.
Properties
Methods
public static ColorAndLabel Define(string label, string color)Configures the component to define.
public ColorPalette AddSwatch(string label, string hexColor)Adds a swatch with a label and hex color.
public ColorPalette Swatches(params ColorAndLabel[] entries)Adds multiple swatches from an array of (label, hexColor) tuples.
public ColorPalette SetValue(string hexColor)Selects a color by hex value programmatically.
public ColorPalette WithCustomColor(bool value = true)Adds a "custom…" swatch that opens the browser color picker.
public ColorPalette OnChange(Action<string> onChange)Registers a callback for when the selected color changes.