With popover swatch
A color swatch button that opens a popover with a 6-column grid of 12 Tailwind-colored swatches, paired with a monospace hex label in a merged-border ButtonGroup row. The swatch grid and hex label are static in this source: selecting a swatch does not update the trigger or the label.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @flx in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { Button27 } from '@/components/flx/patterns/button/button-27'export default function Example() { return <Button27 />}- Showing a compact color picker trigger in toolbars, forms, or settings rows where a preset palette is enough
- Pairing a color swatch with its hex value in a single merged-border control
- Demonstrating the ButtonGroup plus Popover composition pattern as a starting point for a custom picker
- Prototyping a color-selection UI before wiring a real color state and onChange handler
Examples
Basic usage
Render the block with no props. The component takes no arguments and renders its own fixed palette and hex label.
import { Button27 } from '@/components/flx/patterns/button/button-27'export default function BasicExample() { return ( <div className="p-6"> <Button27 /> </div> )}In a toolbar with other actions
Place the swatch control beside a regular shadcn Button inside a flex toolbar row.
import { Button } from '@/components/ui/button'import { Button27 } from '@/components/flx/patterns/button/button-27'export function ToolbarExample() { return ( <div className="flex items-center gap-2"> <Button27 /> <Button variant="ghost">Reset</Button> </div> )}Within a labeled settings row
Show the block next to a plain text label to illustrate a settings-style layout.
import { Button27 } from '@/components/flx/patterns/button/button-27'export function SettingsRowExample() { return ( <div className="flex items-center justify-between gap-4 rounded-md border p-4"> <span className="text-sm font-medium">Accent color</span> <Button27 /> </div> )}Accessibility
- The trigger button has aria-label 'Pick color' because its only visible content is a decorative colored span.
- Each swatch is a native button with type='button' and aria-label set to its hex value (for example '#EF4444'), so screen readers announce the color name as hex.
- Keyboard users can open the popover and move between swatches with Tab; focus-visible rings on swatches make the focused item visible.
- Popover focus management and Escape-to-dismiss come from the underlying popover primitive; this block does not add its own handling.
- The hex label is plain text and is not linked to the trigger or announced as the current value, and the selected state is not exposed, since the source does not track selection. Add a live region and state, and use aria-pressed or aria-selected, when wiring real selection.
- Because the source has no selection state, the trigger always shows blue-500 and the label always shows #3B82F6 regardless of which swatch is clicked.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "With popover swatch" component (flx/button-27) from its shadcn registry.1. Install it with: npx shadcn@latest add @flx/button-272. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { Button27 } from '@/components/flx/patterns/button/button-27'export default function Example() { return <Button27 />}```Files & dependencies
- registry/patterns/button/button-27.tsx→ components/flx/patterns/button/button-27.tsx