Tesserae

ColorPicker

Description

The ColorPicker component provides a native browser widget for selecting colors. It is part of the Tesserae UI library's Components group and is ideal when you need to allow users to choose colors in your application. By default, it displays black unless a different preset color is specified. The component supports programmatically setting its value and validating user input.

Usage

Instantiate the ColorPicker using the Tesserae.UI static helper method. You can either create a basic ColorPicker or specify a preset color by providing a Color argument. The component exposes a Color property for getting or setting the current color, and a SetColor method to update the color, which in turn updates the displayed hex value.

API reference

class

ColorPicker

public class ColorPicker : Input<ColorPicker>

A form input for picking a color, backed by the browser's native color input.

Constructors

Constructor
ColorPicker
public ColorPicker(Color color) : base("color", color?.ToHex() ?? "#000000")

Initializes a new instance of this class.

Properties

Property
ColorPicker.Color
public Color Color { get ; set ; }

Gets or sets the color of the component.

Methods

Method
ColorPicker.SetColor
public ColorPicker SetColor(Color color)

Sets the color of the component.

Samples

Basic Usage of ColorPicker

The following sample demonstrates how to instantiate the ColorPicker component, attach an event handler to update another component's background based on the selected color, and display the currently selected value when a button is clicked.

See also

© 2026 Tesserae. All rights reserved.