Skip to content
UI Brok

Loading…

No results

Browse catalog

Color Palette

A grid or scale strip of colour swatches with name/value labels and per-swatch copy, for design-system docs. Supports a heading label and a vertical scale orientation.

Preview

Brand
Primary
#6366f1
Secondary
#a78bfa
Success
#22c55e
Warning
#f59e0b
Destructive
#ef4444
Info
#0ea5e9
Blue ramp
50
#eff6ff
200
#bfdbfe
400
#60a5fa
600
#2563eb
800
#1e40af
950
#172554
Slate ramp (vertical)
100
#f1f5f9
300
#cbd5e1
500
#64748b
700
#334155
900
#0f172a

Controls

Theme
Surface
Direction
Viewport

Device view renders in an isolated frame so real responsive breakpoints apply. Switch to Full for overflowing popovers.

Installation

terminal
php artisan ui:add color-palette

Registry contract

Install confidence

php artisan ui:add color-palette writes only the generated targets below. The CLI validates each file hash before writing and prompts before replacing local changes unless --force is used.

Version
1.1.0
License
open
Stability
stable
Contract
v2
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/components/ui/color-palette.blade.php

Registry dependencies

copy-button

Package dependencies

composer: jml/brok:^1.0

Guidance

Developer and documentation tool

Expose exact technical or diagnostic information.

Use when

  • Use for exact technical detail, code readability, diagnostics, and copyable reference material. Do not surface developer-specific patterns in end-user flows unless the task genuinely requires them.

Avoid when

  • Avoid using color-palette as a default simply because it is available in the library. Choose it only when its interaction cost, visibility, and behavior match the job to be done.
Task length
medium
Interaction cost
medium
Interruptiveness
none
Input precision
precise
Mobile / touch risk
low
Accessibility risk
medium
Needs background context
No
Comparison needed
No

Preferred alternatives

  • Plain-language product UI for nontechnical users

Anti-patterns

  • Exposing developer tooling in end-user flows without a task need
Related: copy-button

API

manifest knowledge + registry-derived coverage

Props

Prop Type / values Default Description
colors array [] Declared by @props in the registry Blade source.
layout string grid Declared by @props in the registry Blade source.
columns int 3 Declared by @props in the registry Blade source.
showName bool true Declared by @props in the registry Blade source.
showValue bool true Declared by @props in the registry Blade source.
label mixed|null null Declared by @props in the registry Blade source.
orientation string horizontal Declared by @props in the registry Blade source.

Slots

Components use the default Blade slot unless a documented subcomponent is installed by the registry item.

Data slots

color-palette color-palette-label color-palette-swatch

Capabilities

wcag-2.2-aa-target responsive rtl darkMode localized

Behavior

  • Uses server-rendered Blade and semantic HTML.
  • Declares registry capability flags: a11y, responsive, rtl, darkMode, localized.

Usage

previews.components.color-palette.default.blade.php Blade
<div class="flex w-full flex-col gap-6">
    <x-ui.color-palette
        label="Brand"
        :columns="3"
        :colors="[
            ['name' => 'Primary', 'value' => '#6366f1'],
            ['name' => 'Secondary', 'value' => '#a78bfa'],
            ['name' => 'Success', 'value' => '#22c55e'],
            ['name' => 'Warning', 'value' => '#f59e0b'],
            ['name' => 'Destructive', 'value' => '#ef4444'],
            ['name' => 'Info', 'value' => '#0ea5e9'],
        ]"
    />

    <x-ui.color-palette
        layout="scale"
        label="Blue ramp"
        :colors="[
            ['name' => '50', 'value' => '#eff6ff'],
            ['name' => '200', 'value' => '#bfdbfe'],
            ['name' => '400', 'value' => '#60a5fa'],
            ['name' => '600', 'value' => '#2563eb'],
            ['name' => '800', 'value' => '#1e40af'],
            ['name' => '950', 'value' => '#172554'],
        ]"
    />

    <div class="max-w-xs">
        <x-ui.color-palette
            layout="scale"
            orientation="vertical"
            label="Slate ramp (vertical)"
            :colors="[
                ['name' => '100', 'value' => '#f1f5f9'],
                ['name' => '300', 'value' => '#cbd5e1'],
                ['name' => '500', 'value' => '#64748b'],
                ['name' => '700', 'value' => '#334155'],
                ['name' => '900', 'value' => '#0f172a'],
            ]"
        />
    </div>
</div>

Accessibility & localization

WCAG 2.2 AA RTL-ready data-slot Keyboard focus-visible Localized labels
  • Accessibility target: wcag-2.2-aa-target.
  • Uses semantic HTML and a stable data-slot attribute for styling/scripting hooks.
  • Focus-visible rings use the ring token so keyboard focus is always visible.
  • Disabled and invalid states are conveyed to assistive tech, not by color alone.
  • Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces above.
  • Labels go through __() and the component uses logical properties (ms-*, text-start, start-*) so it mirrors correctly — flip the preview to RTL to confirm.

Source

The exact, editable file ui:add writes into your app — copy it or own the whole thing. Previews render this same code; there are no preview-only components.

Changelog

Current version: v1.1.0. See the site changelog for the full release history.