Color Picker
The smallest headless setup: a swatch-only trigger that opens Coloris and updates shared Render only preset swatches while still allowing clear and close actions. Build custom input layouts with Three isolated provider instances in one form. Each trigger button renders a leading swatch and current color, with hidden named inputs for standard HTML post payloads. The primary configuration options on On color changes, the provider dispatches To override default sources (CDN/self-hosted), configure RzColorPickerProvider is an SSR-first headless provider that exposes shared Alpine state as colorPicker.* for composable trigger/input UIs. It integrates the Coloris color picker while letting you compose semantic triggers with RzColorPickerTrigger and previews with RzColorSwatch.colorPicker.value state.<RzColorPickerProvider Value="#22c55e"
Alpha="true"
Swatches="@_displaySwatches">
<RzColorPickerTrigger class="inline-flex rounded-md p-1">
<RzColorSwatch x-model="colorPicker.value" Size="ColorSwatchSize.Large" />
</RzColorPickerTrigger>
</RzColorPickerProvider><RzColorPickerProvider Value="@_model.AccentColor"
Swatches="@_swatches"
SwatchesOnly="true"
CloseButton="true"
ClearButton="true">
<RzColorPickerTrigger AsChild="true">
<button type="button" class="inline-flex h-9 items-center gap-2 rounded-md border px-3 text-sm">
<RzColorSwatch x-model="colorPicker.value" Size="ColorSwatchSize.Small" />
<span x-text="colorPicker.value"></span>
</button>
</RzColorPickerTrigger>
<input type="text" x-model="colorPicker.value" />
</RzColorPickerProvider>RzInputGroup. These two fields show swatch triggers placed both before and after the text input, while still binding value through x-model="colorPicker.value".<EditForm Model="_model">
<Field>
<FieldLabel For="@(() => _model.CustomStartColor)">Swatch at Start</FieldLabel>
<RzColorPickerProvider Value="@_model.CustomStartColor" Format="ColorFormat.Hex" Alpha="true" Swatches="@_swatches">
<RzInputGroup>
<RzColorPickerTrigger>
<InputGroupAddon Align="InputGroupAddonAlign.InlineStart" class="pl-0">
<RzColorSwatch x-model="colorPicker.value" />
</InputGroupAddon>
</RzColorPickerTrigger>
<InputGroupInput For="@(() => _model.CustomStartColor)" x-model="colorPicker.value" />
</RzInputGroup>
</RzColorPickerProvider>
</Field>
</EditForm><form class="space-y-4">
<RzColorPickerProvider Value="#386fc7" Alpha="true">
<RzColorPickerTrigger AsChild="true">
<RzButton type="button" Variant="ThemeVariant.Accent" Outline class="h-9 items-center gap-2 px-3">
<RzColorSwatch x-model="colorPicker.value" Size="ColorSwatchSize.Small" />
<span x-text="colorPicker.value"></span>
</RzButton>
</RzColorPickerTrigger>
<input type="hidden" name="themePrimary" x-model="colorPicker.value" />
</RzColorPickerProvider>
<RzButton type="button" Disabled="true">Save Theme</RzButton>
</form>RzColorPickerProvider when building custom Color Picker experiences.Parameter Type Default Description ChildContentRenderFragment?nullContent rendered within provider scope. Valuestring?nullInitial color value loaded into colorPicker.value.FormatColorFormatHexOutput format used by Coloris. AlphaboolfalseEnables opacity selection. SwatchesIEnumerable<string>?nullOptional preset swatch list. SwatchesOnlyboolfalseRestricts selection to configured swatches. CloseButtonboolfalseShows the Coloris close button. ClearButtonboolfalseShows the Coloris clear button. ComponentAssetKeysstring[]["Coloris"]Logical asset keys resolved through RizzyUIConfig.AssetUrls.RzColorPickerProvider exposes colorPicker.value, colorPicker.open, colorPicker.setValue(value), colorPicker.getValue(), and colorPicker.updateConfiguration(config).rz:colorpicker:onchange (also available as Constants.Events.ColorPickerOnChange in C#).Event Detail Field Description colorPickerReference to provider Alpine state (including value and helper methods).updateConfiguration(config)Method to patch current Coloris runtime configuration for this provider. elReference to this provider's proxy text input anchor. providerElThe provider Alpine root element. // Close the active Coloris dialog
Coloris.close();
// Close and revert to the original value
Coloris.close(true);RzColorPickerProvider loads Coloris JavaScript from configured asset URLs at runtime.AssetUrls during service registration:builder.Services.AddRizzyUI(config =>
{
config.AssetUrls["Coloris"] = "https://cdn.jsdelivr.net/gh/mdbassit/Coloris@latest/dist/coloris.min.js";
});RzColorPickerProvider uses Coloris accessibility strings from RizzyLocalization.en.resx.Localization Key Default Value 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.