Easeout LabPixel Select
Pixel Select
A select whose menu assembles out of pixels when it opens and dissolves back into the pill when you pick. Each option has its own pixel tint.
Install
npx shadcn add@easeout/pixel-selectDependencies
motiontailwindcss
Tags
InputsFree componentMIT
Usage
After installing, it lives at components/pixel-select.tsx
"use client"
import { useState } from "react"
import { PixelSelect } from "@/components/pixel-select"
const plans = [
{ value: "starter", label: "Starter · $19/mo", tint: "#FF5A1F" },
{ value: "pro", label: "Pro · $49/mo", tint: "#0E0E0E" },
{ value: "team", label: "Team · $99/mo", tint: "#C9A27E" },
]
export default function Example() {
const [plan, setPlan] = useState("pro")
return <PixelSelect label="Plan" options={plans} value={plan} onChange={setPlan} />
}
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
label | string | – | The muted label on the left of the pill, e.g. "I need". Also names the listbox. |
options | { value: string; label: string; tint: string }[] | – | The choices. tint is a hex colour for that option's pixels. |
value | string | – | The selected option's value (controlled). |
onChange | (value: string) => void | – | Called with the picked option's value. |
pixelSize | number | 6 | Size of each pixel in CSS px. Bigger pixels mean fewer of them. |
className | string | – | Classes for the wrapper. It's full width up to 360px by default. |
FAQ
- Is it accessible?
- Yes. The pill is a combobox that keeps focus and points at the active option with aria-activedescendant. Enter, Space or ArrowDown opens it, arrows move, Enter picks, Esc closes and Tab moves on.
- What about reduced motion?
- No pixels at all. The menu fades in over 120ms and out over 80ms.
- Is the canvas expensive?
- It only runs while pixels move, about a third of a second, and the loop stops when they land. It draws at most 1,200 pixels, and half as many on phones.
- Does it need Radix?
- No. It's one file with React, Motion and Tailwind CSS. The listbox is written by hand, with the same keyboard behaviour as a native select.