A compact color picker with a custom spectrum input and preset swatches. Integrates with Angular Forms via [(ngModel)] or formControlName. Emits a hex string on every change.
Click the swatch button to open the picker. Select a preset or type a hex value directly.
Selected
#3b82f6Each instance maintains its own state independently.
#3b82f6#8b5cf6Override the preset swatch palette via the [swatches] input.
Run the following command to add this component to your project:
npx base-ui-cli add color-picker
For AI agents
Copy a prompt with the registry name, CLI install, and import — or add the Base UI MCP server.
npx -y base-ui-mcp
Base UI provides standalone components. Import the exact elements you want to use into your component.
// Install: npx base-ui-cli add color-picker
// Paths are relative to aliases.components (default: src/app/components)
import { ColorPickerComponent } from './color-picker/color-picker.component';
@Component({
selector: 'app-your-component',
imports: [
ColorPickerComponent
],
template: `...`
})
export class YourComponent {} API for color-picker — generated from JSDoc in the library source.
| API | Member | Type | Default | Description |
|---|---|---|---|---|
base-color-picker | class | string | '' | Additional host CSS classes (merged via cn()). |
base-color-picker | pickerLabel | unknown | 'Color picker' | — |
base-color-picker | swatches | string[] | [ '#ef4444','#f97316','#eab308','#22c55e','#14b8a6', '#3b82f6','#8b5cf6','#ec4899','#64748b','#0f172a', '#ffffff','#f1f5f9'] | — |
base-color-picker | disabled | boolean | false | Whether the control is disabled (consumer-facing input). |
Content