ShadcnSpace

Select With Separator

Forms

About

A dropdown select input that groups related options under labeled sections divided by separators, for forms with categorized choices.

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

Code

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

Usage.tsx

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

function SelectWithSeparatorDemo() {
  const id = useId();

  return (
    <div className="w-full max-w-xs space-y-2">
      <Label htmlFor={id}>Select Your Focus Area</Label>
      <Select defaultValue="Leadership" defaultOpen>
        <SelectTrigger id={id} className="w-full">
          <SelectValue />
        </SelectTrigger>
        <SelectContent className="data-[state=open]:slide-in-from-bottom-8 data-[state=open]:zoom-in-100 duration-400">
          <SelectGroup>
            <SelectLabel>Professional Skills</SelectLabel>
            <SelectItem value="Leadership">Leadership</SelectItem>
            <SelectItem value="Communication">Communication</SelectItem>
            <SelectItem value="Project Management">
              Project Management
            </SelectItem>
          </SelectGroup>
          <SelectSeparator />
          <SelectGroup>
            <SelectLabel>Personal Growth</SelectLabel>
            <SelectItem value="Mindfulness">Mindfulness</SelectItem>
            <SelectItem value="Time Management">Time Management</SelectItem>
            <SelectItem value="Creativity">Creativity</SelectItem>
          </SelectGroup>
          <SelectSeparator />
          <SelectGroup>
            <SelectLabel>Technology & Innovation</SelectLabel>
            <SelectItem value="AI & Machine Learning">
              AI & Machine Learning
            </SelectItem>
            <SelectItem value="Blockchain">Blockchain</SelectItem>
            <SelectItem value="Web Development">Web Development</SelectItem>
          </SelectGroup>
        </SelectContent>
      </Select>
    </div>
  );
}

export default function Preview() {
  return (
    <div className="flex w-full items-center justify-center p-10">
      <SelectWithSeparatorDemo />
    </div>
  );
}

More by ShadcnSpace

View all
  • Integration Card

    Integration Card

    1.9K
  • Stacked Card Carousel

    Stacked Card Carousel

    1.6K
  • Button witn Icon

    Button witn Icon

    1.5K
  • Orbiting Circles with Globe

    Orbiting Circles with Globe

    1.4K
  • Agency Hero Section

    Agency Hero Section

    1K
  • Testimonials Marquee

    Testimonials Marquee

    669
  • Range Select Calendar

    Range Select Calendar

    492
  • Shine Border

    Shine Border

    492

More in Forms

View all
  • Login 1

    Login 1

    64
  • Premium Auth

    Premium Auth

    571
  • Contact Card

    Contact Card

    1.1K
  • Form

    Form

    18
  • Book A Demo 1

    Book A Demo 1

    91
  • Authentication Card

    Authentication Card

    52
  • Card Studio

    Card Studio

    47
  • Login Card

    Login Card

    35