ColorField

A color picker field that combines the browser’s native type="color" swatch with a text input for manual hex value entry. Both inputs stay in sync and update the bound value.

Basic Usage

<ArcadiaForm Model="model">
    <ColorField Field="@nameof(Model.BrandColor)" Label="Brand Color" />
</ArcadiaForm>

Parameters

ParameterTypeDefaultDescription
Valuestring?nullThe selected color as a hex string (e.g., "#ff5733"). Null when no color has been chosen. Supports two-way binding.
ValueChangedEventCallback<string?>Callback invoked when the user picks a color or edits the hex text input.

Inherited from FieldBase

ParameterTypeDefaultDescription
Labelstring?nullVisible label displayed above the field.
HelperTextstring?nullHelper text displayed below the field.
RequiredboolfalseWhether the field is required.
DisabledboolfalseWhether both the color swatch and text input are disabled.
ErrorsIReadOnlyList<string>?nullValidation errors to display.
SchemaFieldSchema?nullField schema definition for dynamic form generation.

Validation

public class ThemeModel
{
    [Required(ErrorMessage = "Please select a brand color.")]
    [RegularExpression(@"^#[0-9a-fA-F]{6}$", ErrorMessage = "Must be a valid hex color (e.g., #ff5733).")]
    public string? BrandColor { get; set; }
}

Accessibility

  • The color swatch input has its label linked via for/id attributes.
  • The hex text input has a dedicated aria-label (e.g., “Brand Color hex value”).
  • Required fields set aria-required="true" and display a visual * indicator.
  • Validation errors are linked via aria-describedby and announced with role="alert".