Select 7

PreviousNext

A native select dropdown with option groups for categorized choices

Docs
shadcn-studiocomponent

Preview

Loading preview…
registry/new-york/components/select/select-07.tsx
import { useId } from 'react'

import { Label } from '@/registry/new-york/ui/label'
import { SelectNative } from '@/registry/new-york/ui/select-native'

const NativeSelectWithOptionGroupsDemo = () => {
  const id = useId()

  return (
    <div className='w-full max-w-xs space-y-2'>
      <Label htmlFor={id}>Native select with option groups</Label>
      <SelectNative id={id}>
        <optgroup label='Frontend Technologies'>
          <option value='1'>HTML</option>
          <option value='2'>CSS</option>
          <option value='3'>JavaScript</option>
        </optgroup>
        <optgroup label='Backend Technologies'>
          <option value='4'>Node.js</option>
          <option value='5'>Python</option>
          <option value='6'>Java</option>
        </optgroup>
      </SelectNative>
    </div>
  )
}

export default NativeSelectWithOptionGroupsDemo

Installation

npx shadcn@latest add @shadcn-studio/select-07

Usage

import { Select07 } from "@/components/select-07"
<Select07 />