Origin UI

Select

Forms 15

About

Enhanced shadcn/ui select

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Select to your project and fits it to your theme.

Code

How Select is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { Label } from "@/components/ui/label";
import {
  Select,
  SelectContent,
  SelectGroup,
  SelectItem,
  SelectLabel,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select";
import { useId } from "react";

function Component() {
  const id = useId();
  return (
    <div className="space-y-2 min-w-[300px]">
      <Label htmlFor={id}>Options with avatar</Label>
      <Select defaultValue="1">
        <SelectTrigger
          id={id}
          className="ps-2 [&>span]:flex [&>span]:items-center [&>span]:gap-2 [&>span_img]:shrink-0"
        >
          <SelectValue placeholder="Select framework" />
        </SelectTrigger>
        <SelectContent className="[&_*[role=option]>span]:end-2 [&_*[role=option]>span]:start-auto [&_*[role=option]>span]:flex [&_*[role=option]>span]:items-center [&_*[role=option]>span]:gap-2 [&_*[role=option]]:pe-8 [&_*[role=option]]:ps-2">
          <SelectGroup>
            <SelectLabel className="ps-2">Impersonate user</SelectLabel>
            <SelectItem value="1">
              <img
                className="size-5 rounded"
                src="https://cdn.21st.dev/assets/localized/35c3ff14432b69cb0728cce7a4f816466df5766fd4c5374b6f8834ce4d31c77a.jpg"
                alt="Frank Allison"
                width={20}
                height={20}
              />
              <span className="truncate">Jenny Hamilton</span>
            </SelectItem>
            <SelectItem value="2">
              <img
                className="size-5 rounded"
                src="https://cdn.21st.dev/assets/localized/5211bab9b6c22536d4eb2ad9b3a59482ffbcb856ca0d76996efc745315f4d0b3.jpg"
                alt="Xavier Guerra"
                width={20}
                height={20}
              />
              <span className="truncate">Paul Smith</span>
            </SelectItem>
            <SelectItem value="3">
              <img
                className="size-5 rounded"
                src="https://cdn.21st.dev/assets/localized/38b00f11e18ebfbd2cd4f9975f51a75e71cd56a9c9385b1f375389dc132d8c6d.jpg"
                alt="Anne Kelley"
                width={20}
                height={20}
              />
              <span className="truncate">Luna Wyen</span>
            </SelectItem>
          </SelectGroup>
        </SelectContent>
      </Select>
    </div>
  );
}

export { Component };

export default Component;

Dependencies

More by Origin UI

View all
  • Dialog

    Dialog

    1.2K
  • Avatar

    Avatar

    975
  • useImageUpload

    useImageUpload

    933
  • usePagination

    usePagination

    628
  • Popover

    Popover

    384
  • Button

    Button

    367
  • Command

    Command

    328
  • Calendar [React Day Picker]

    Calendar [React Day Picker]

    265

More in Forms

View all
  • Premium Auth

    Premium Auth

    524
  • Contact Card

    Contact Card

    1K
  • Book A Demo 1

    Book A Demo 1

    73
  • Form

    Form

    16
  • Login 1

    Login 1

    53
  • Book A Demo 3

    Book A Demo 3

    89
  • Hand-Drawn Checkbox

    Hand-Drawn Checkbox

    48
  • Login Card

    Login Card

    6