Docs
Select Input
Select Input

A versatile dropdown select component with pill variant support, validation, and Zod integration for efficient option selection.

Choose one of the available options

Overview

The Select Input component delivers an intuitive dropdown selection experience with both default and pill variants, making it essential for forms requiring single-option choices from larger datasets. It features native and custom dropdown implementations, comprehensive validation, and accessibility support. Perfect for category selections, filtering interfaces, and any scenario where users need to choose from multiple predefined options.

Installation

pnpm dlx shadcn@latest add https://deltacomponents.dev/r/select-input.json

Usage

"use client"
 
import { SelectInput } from "@/registry/inputs/select-input"
 
export function Component() {
  const options = [
    { value: "starter", label: "Starter Plan" },
    { value: "professional", label: "Professional Plan" },
    { value: "enterprise", label: "Enterprise Plan" },
  ]
 
  return (
    <SelectInput
      label="Subscription Plan"
      name="plan"
      options={options}
      placeholder="Choose your plan"
      required
      onValueChange={(value) => console.log("Selected:", value)}
    />
  )
}

API Reference

Props

PropTypeDefaultDescription
labelstring-Label for the select field (required)
namestring-Name of the select field for form submission (required)
optionsSelectOption[]-Options for the dropdown (required)
descriptionstringundefinedDescription text below the label
hintstringundefinedHint text below the select
errorstringundefinedError message to display
requiredbooleanfalseWhether the field is required
pendingbooleanfalseWhether the field is in a loading state
defaultValuestringundefinedDefault selected value
valuestringundefinedControlled selected value
placeholderstring"Select an option"Placeholder text when no option is selected
disabledbooleanfalseWhether the select is disabled
idstringnameID for the select element
variant"default" | "pill""default"Visual variant of the select
coloredBorderbooleanfalseWhether to show colored border (pill variant)
labelVariant"default" | "muted""default"Label text styling variant
containerClassNamestring""CSS classes for the container
selectClassNamestring""CSS classes for the select trigger
labelClassNamestring""CSS classes for the label
schemaZodType<string>undefinedZod schema for validation
onValidate(isValid: boolean, value: string, error?: string) => voidundefinedValidation callback
onValueChange(value: string) => voidundefinedCallback when selection changes

SelectOption Interface

interface SelectOption {
  value: string
  label: string
  disabled?: boolean
}

Examples

Pill Variant

Rounded pill variant with muted background styling for modern form interfaces.

Pill variant has a rounded, muted background style