Skip to content
Bladewell
Components
Accordion
Alert
Breadcrumbs
Button
Calendar
Chat
Clock
Command palette
Dropdown
Captcha
Checkbox
Colour picker
Date picker
Date range picker
File upload
Filter builder
Image cropper
Number
OTP
Password
Phone
Radio
Repeater
Search
Select
Show if
Slider
Sortable list
Switch
Tags input
Text input
Textarea
Time picker
Verification code
Field
Icon
Kanban
Auth layout
Sidebar layout
Modal
Pagination
Popover
Price roll
Progress
Stepper
Table
Tabs
Toast
Tooltip
Tooltip cursor
Tree
Docs
Installation
Why Bladewell
For AI agents
Guides
Build a Laravel form from your validation rules
Add a date range picker to a Laravel form
Laravel data table with sorting, filters, pagination
Editable table cells in Laravel with Livewire
A Livewire modal that stays open through re-renders
Using Blade components in Livewire 3 and 4
Two-factor authentication screens for Laravel Fortify
Passkey sign-in for Laravel with Fortify
Real-time notification bell with Laravel Reverb
AI agent actions with Approve and Deny in Laravel
Laravel AI chat with Livewire and streaming replies
Livewire multi-step form with validation per step
Toast notifications in Laravel and Livewire
Livewire file upload with progress and drag and drop
Laravel searchable select that loads from the database
Laravel Blade card, avatar and empty state patterns
Add charts and a rich text editor to a Laravel app
Compare
Bladewell vs Flux: a Free Alternative for Laravel
Bladewell vs Mary UI: daisyUI or Plain Blade
Bladewell vs WireUI: With or Without Alpine
Blade UI Kit Alternative for Laravel 12 and 13
Bladewell vs BladewindUI: Laravel Blade Components
Bladewell vs Sheaf UI: With or Without Alpine
Bladewell vs April UI: Package or Copied-in Code

<x-widget.color-picker>

Colour picker Blade component for Laravel and Livewire

A colour in a field: a hex box that submits #rrggbb, the browser's own picker beside it for any colour, and optional swatches as a radio group, named for screen readers. A preview shows the colour with black or white text, whichever reads better. Typing #abc or #ABCDEF tidies to #aabbcc, and anything that isn't a colour goes back to the last one. Works with Livewire wire:model.

php artisan bladewell:add color-picker
Works with
Laravel 12 and 13, Livewire 3 and 4, Tailwind CSS 4.1+, PHP 8.3+

Usage

Livewire

In a Livewire component, bind with wire:model (deferred) or wire:model.live to a string property: public string $accent = '#7c3aed'. No name is needed. A swatch, the browser's picker or a typed colour updates it, and setting it in PHP selects the matching swatch and repaints the preview after the render.

Blade
<x-widget.color-picker label="Accent colour" wire:model.live="accent" :swatches="['#dc2626', '#16a34a', '#2563eb']" />

On the server

The colour picker can't stop a request that skips it. Here's what to check on your server.

Security

Examples

Basic

A hex box that submits #rrggbb, with the browser's own picker beside it. Typing #ABC tidies to #aabbcc when you leave the box; text that isn't a colour goes back to the last one. Validate with 'hex_color'.

Show code
Blade
<x-widget.color-picker name="accent" label="Accent colour" value="#7c3aed" class="max-w-xs" />

Swatches

swatches offers colours to pick in one click, as a radio group: the arrow keys move between them, and a screen reader hears each one's name. Give them names (name => hex) or a plain list of hex values. custom="false" leaves out the browser's own picker, so only the box and the swatches choose.

Show code
Blade
<x-widget.color-picker name="label_color" label="Label colour" value="#16a34a" :custom="false" :swatches="[
    'Red' => '#dc2626',
    'Amber' => '#d97706',
    'Green' => '#16a34a',
    'Teal' => '#0d9488',
    'Blue' => '#2563eb',
    'Violet' => '#7c3aed',
    'Slate' => '#475569',
]" class="max-w-xs" />

Props

Other attributes, such as autocomplete or data-*, are passed through to the element. class styles the component's outer wrapper.

<x-widget.color-picker>

Prop Default Description
name null What the colour submits as (#rrggbb); its error and old input are found under it. Optional with wire:model, which then names it.
id null Defaults to one made from the name (or the wire:model property).
label null Shown above the field, and its name for screen readers.
value null The colour, as #rrggbb or #rgb. Old input wins after a failed submit; with wire:model and no value, the bound property.
swatches [] Colours to pick from in one click: a list of hex values, or name => hex ("Brand" => "#7c3aed"), whose names screen readers hear.
custom true Offers the browser's own picker beside the box, for any colour. false for the swatches and the box only.
error null An error message of your own; otherwise the validation error for the name, from the session or Livewire.
info null A hint under the field.
bag 'default' Which error bag to read the error from.
disabled false Greyed out: it can't be changed.
readonly false Shown, and submitted, but it can't be changed: no picker or swatches, and the box can't be typed in. With disabled, disabled wins.

Accessibility

All 2 examples above are checked with axe-core against the WCAG 2.2 A and AA rules, in the light theme and the dark one, both as the page draws and with each popover, dialog, toast and tooltip opened, on every change. A change that fails can't be merged. Where axe can't decide, such as contrast on SVG text, the test measures the colours itself instead of letting it pass.

Automated checks can't judge everything: how it sounds in a screen reader, and how it feels to use from the keyboard, still need a person. Check those on your own pages too.

Source

What bladewell:add color-picker writes to your app with the default namespaces. Prefer to copy by hand? Take these files, plus the ones from Field, and the theme and base CSS.

resources/views/components/widget/color-picker/index.blade.php Show
index.blade.php
resources/js/widget/color-picker/index.js Show
index.js
app/View/Widget/ElementIds.php Show
ElementIds.php
app/View/Widget/FormField.php Show
FormField.php