Tesserae

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

class

ColorPalette

public sealed class ColorPalette : ComponentBase<ColorPalette, HTMLElement>

A grid of named colour swatches for letting users pick from a predefined palette.

Constructors

Constructor
ColorPalette
public ColorPalette()

Initializes a new instance of this class.

Properties

Property
ColorPalette.Value
public string Value

Gets the currently selected hex color string.

Methods

Method
ColorPalette.Define
public static ColorAndLabel Define(string label, string color)

Configures the component to define.

Method
ColorPalette.AddSwatch
public ColorPalette AddSwatch(string label, string hexColor)

Adds a swatch with a label and hex color.

Method
ColorPalette.Swatches
public ColorPalette Swatches(params ColorAndLabel[] entries)

Adds multiple swatches from an array of (label, hexColor) tuples.

Method
ColorPalette.SetValue
public ColorPalette SetValue(string hexColor)

Selects a color by hex value programmatically.

Method
ColorPalette.WithCustomColor
public ColorPalette WithCustomColor(bool value = true)

Adds a "custom…" swatch that opens the browser color picker.

Method
ColorPalette.OnChange
public ColorPalette OnChange(Action<string> onChange)

Registers a callback for when the selected color changes.

Method
ColorPalette.Render
public override HTMLElement Render()

Renders the component's root HTML element.

Samples

Brand Palette

Semantic Colours

See also

© 2026 Tesserae. All rights reserved.