Select with Background Color

PreviousNext

A select component with custom background color

Docs
shadcnui-blockscomponent

Preview

Loading preview…
components/customized/select/select-02.tsx
import {
  Select,
  SelectContent,
  SelectGroup,
  SelectItem,
  SelectLabel,
  SelectTrigger,
  SelectValue,
} from "@/registry/ui/select";

export default function SelectBackgroundColorDemo() {
  return (
    <Select defaultValue="apple">
      <SelectTrigger className="w-44 bg-indigo-600/25 dark:text-white text-indigo-600 border-none shadow-none">
        <SelectValue placeholder="Select a fruit" />
      </SelectTrigger>
      <SelectContent>
        <SelectGroup className="[&_div:focus]:bg-indigo-600 [&_div:focus]:text-white">
          <SelectLabel>Fruits</SelectLabel>
          <SelectItem value="apple">Apple</SelectItem>
          <SelectItem value="banana">Banana</SelectItem>
          <SelectItem value="blueberry">Blueberry</SelectItem>
          <SelectItem value="grapes">Grapes</SelectItem>
          <SelectItem value="pineapple">Pineapple</SelectItem>
        </SelectGroup>
      </SelectContent>
    </Select>
  );
}

Installation

npx shadcn@latest add @shadcnui-blocks/select-02

Usage

import { Select02 } from "@/components/select-02"
<Select02 />