Color Picker
A complete starter setup that keeps Hex format, enables alpha, shows reusable swatches, and includes close/clear controls. You can open the picker by clicking either the input or the color thumbnail. Enable alpha support and output values in RGB format. Render only preset swatches while still allowing clear and close actions. Choose whether the thumbnail appears at the start or end of the input group. The thumbnail is also a picker trigger, matching common color-input UX conventions. The primary configuration options on When the color changes, RzColorPicker dispatches a custom DOM event named To close the currently active Coloris dialog from your own scripts, use the global API: When To override the defaults (for a newer CDN path or local/self-hosted delivery), customize RzColorPicker is an SSR-first RizzyUI form component that integrates the Coloris color picker through Alpine.js. It renders a standard input for HTML form posts while progressively enhancing the experience with client-side color selection, swatches, accessibility labels, and runtime configuration updates.<EditForm Model="_model">
<Field>
<FieldLabel For="@(() => _model.BrandColor)">Brand Color</FieldLabel>
<RzColorPicker For="@(() => _model.BrandColor)"
Value="@_model.BrandColor"
Format="ColorFormat.Hex"
Alpha
Swatches="@_swatches"
CloseButton
ClearButton />
</Field>
</EditForm><RzColorPicker For="@(() => _model.OverlayColor)"
Value="@_model.OverlayColor"
Alpha="true"
Format="ColorFormat.Rgb" /><RzColorPicker For="@(() => _model.AccentColor)"
Value="@_model.AccentColor"
Swatches="@_swatches"
SwatchesOnly="true"
CloseButton="true"
ClearButton="true" /><RzColorPicker For="@(() => _model.StartThumbColor)"
Value="@_model.StartThumbColor"
ThumbnailPosition="ColorThumbnailPosition.Start" />
<RzColorPicker For="@(() => _model.EndThumbColor)"
Value="@_model.EndThumbColor"
ThumbnailPosition="ColorThumbnailPosition.End" />RzColorPicker.Parameter Type Default Description Valuestring?nullCurrent color value rendered into the input. ForExpression<Func<string>>?nullConnects the picker to form metadata and validation. FormatColorFormatHexOutput format sent to Coloris ( Hex, Rgb, or Hsl).AlphaboolfalseEnables opacity selection. SwatchesIEnumerable<string>?nullOptional swatch list shown in the Coloris dialog. SwatchesOnlyboolfalseLimits selection to swatches only. CloseButtonboolfalseShows the dialog close button. ClearButtonboolfalseShows the dialog clear button. Placeholderstring?"Select a color"Input placeholder text (localized by default). ThumbnailPositionColorThumbnailPositionStartPlaces the thumbnail at the start or end of the input group. ComponentAssetKeysstring[]["Coloris", "ColorisCss"]Logical asset keys resolved through RizzyUIConfig.AssetUrls.RzColorPicker uses the Alpine component rzColorPicker with key-based expressions only (CSP-safe). The root exposes methods such as handleInput, openPicker, and updateConfiguration(config).rz:colorpicker:on-change (also available as Constants.Events.ColorPickerOnChange in C#).Event Detail Field Description rzColorPickerReference to the Alpine rzColorPicker component instance.updateConfiguration(config)Method reference you can call to update the active Coloris instance and the local component config. elReference to the underlying input element ( this.$refs.input).// Close the dialog
Coloris.close();
// Close the dialog and revert the color to its original value
Coloris.close(true);RzColorPicker is rendered, it dynamically loads the third-party Coloris JavaScript from jsdelivr.net using the configured asset URLs.AssetUrls in Program.cs when registering RizzyUI services:builder.Services.AddRizzyUI(config =>
{
config.AssetUrls["Coloris"] = "https://cdn.jsdelivr.net/gh/mdbassit/Coloris@latest/dist/coloris.min.js";
});RzColorPicker uses the following localization keys from RizzyLocalization.en.resx.Localization Key Default Value RzColorPicker.DefaultPlaceholderSelect a color RzColorPicker.A11y.OpenOpen color picker RzColorPicker.A11y.CloseClose color picker RzColorPicker.A11y.ClearClear selected color RzColorPicker.A11y.MarkerSaturation: {s}. Brightness: {v}. RzColorPicker.A11y.HueSliderHue slider RzColorPicker.A11y.AlphaSliderOpacity slider RzColorPicker.A11y.FormatColor format RzColorPicker.A11y.SwatchColor swatch {i}: {swatch} RzColorPicker.A11y.InputColor value field RzColorPicker.A11y.InstructionSaturation and brightness selector. Use arrow keys to select.